From: Bartek Przybylski Date: Sat, 9 Jun 2012 13:22:02 +0000 (+0200) Subject: handle encrypted images files in oc_image X-Git-Tag: v4.5.0beta1~74^2~422^2~16^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=120997112c7acf490171d07ec32cdd6d091db9c2;p=nextcloud-server.git handle encrypted images files in oc_image --- diff --git a/lib/image.php b/lib/image.php index 5a2e8202488..41e8c744d8c 100644 --- a/lib/image.php +++ b/lib/image.php @@ -407,11 +407,14 @@ class OC_Image { break; */ default: - error_log($imagepath); - error_log(\OC_Filesystem::getInternalPath($imagepath)); - error_log(\OC_Filesystem::getLocalFile($imagepath)); + // this is mostly file created from encrypted file - $this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents(\OC_Filesystem::getInternalPath($imagepath))); + $datadir = \OCP\Config::getSystemValue('datadirectory').'/'.\OC_User::getUser().'/files'; + $newimgpath = $imagepath; + if (strncmp($newimgpath, $datadir, strlen($datadir)) == 0) { + $newimgpath = substr($imagepath, strlen($datadir)); + } + $this->resource = imagecreatefromstring(\OC_Filesystem::file_get_contents($newimgpath)); $itype = IMAGETYPE_PNG; OC_Log::write('core','OC_Image->loadFromFile, Default', OC_Log::DEBUG); break;