]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle encrypted images files in oc_image
authorBartek Przybylski <bart.p.pl@gmail.com>
Sat, 9 Jun 2012 13:22:02 +0000 (15:22 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sun, 10 Jun 2012 11:19:05 +0000 (13:19 +0200)
lib/image.php

index f4c944e10d6f2dc081ff3b13de3b3fb69558b1f9..77efc56d8ccb386a0d1d8237df777cb8a5724f2e 100644 (file)
@@ -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;