. * */ namespace OCA\Contacts\Utils\TemporaryPhoto; use OCA\Contacts\Contact as ContactObject, OCA\Contacts\Utils\TemporaryPhoto as AbstractTemporaryPhoto; /** * This class loads an image from the virtual file system. */ class FileSystem extends AbstractTemporaryPhoto { /** * The virtual file system path to load the image from * * @var string */ protected $path; public function __construct(\OCP\IServerContainer $server, $path) { \OCP\Util::writeLog('contacts', __METHOD__.' path: ' . $path, \OCP\Util::DEBUG); if (!is_string($path)) { throw new \Exception( __METHOD__ . ' Second argument must a string' ); } parent::__construct($server); $this->path = $path; $this->processImage(); } /** * Load the image. */ protected function processImage() { $localpath = \OC\Files\Filesystem::getLocalFile($this->path); $this->image = new \OCP\Image(); $this->image->loadFromFile($localpath); } }