diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-09 15:22:02 +0200 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-06-10 13:19:05 +0200 |
commit | e7d1af48fb4695c3fa0fe10b3f2d930e555a648e (patch) | |
tree | 1c0d4d04781081a64dae5cc4f9de2c7fa8d77674 | |
parent | 7ee722e0dafbd9e0b38014e063ec3c425368d2e7 (diff) | |
download | nextcloud-server-e7d1af48fb4695c3fa0fe10b3f2d930e555a648e.tar.gz nextcloud-server-e7d1af48fb4695c3fa0fe10b3f2d930e555a648e.zip |
handle encrypted images files in oc_image
-rw-r--r-- | lib/image.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/image.php b/lib/image.php index f4c944e10d6..77efc56d8cc 100644 --- a/lib/image.php +++ b/lib/image.php @@ -400,11 +400,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; |