. * */ namespace OCA\Contacts\Utils\TemporaryPhoto; use OCA\Contacts\Contact as ContactObject, OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto; /** * This class loads the PHOTO or LOGO property from a contact. */ class Contact extends BaseTemporaryPhoto { /** * The Contact object to load the image from * * @var OCA\Contacts\Contact */ protected $contact; public function __construct(\OCP\IServerContainer $server, $contact) { if (!$contact instanceof ContactObject) { throw new \Exception( __METHOD__ . ' Second argument must be an instance of OCA\\Contacts\\Contact' ); } parent::__construct($server); $this->contact = $contact; $this->processImage(); } /** * Do what's needed to get the image from storage * depending on the type. */ protected function processImage() { $this->image = $this->contact->getPhoto(); } }