From: Robin Appelman Date: Thu, 26 Jan 2012 17:12:59 +0000 (+0100) Subject: use oc_filesystem::getlocalfile instead of manually trying to get the correct local... X-Git-Tag: v3.0~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=266fbb442ebefbec92d159204833848edf314fcf;p=nextcloud-server.git use oc_filesystem::getlocalfile instead of manually trying to get the correct local file when creating album covers fixes broken album covers on shared files --- diff --git a/apps/gallery/ajax/cover.php b/apps/gallery/ajax/cover.php index 181a919375d..068a6e9c4ec 100644 --- a/apps/gallery/ajax/cover.php +++ b/apps/gallery/ajax/cover.php @@ -70,11 +70,11 @@ $x = min((int)($x/($box_size/$result->numRows())), $result->numRows()-1); // get $result->seek($x); // never throws $path = $result->fetchRow(); $path = $path['file_path']; -$tmp = OC::$CONFIG_DATADIRECTORY . $path; -$imagesize = getimagesize($tmp); +$imagePath = OC_Filesystem::getLocalFile($img); +$imagesize = getimagesize($imagePath); header('Content-Type: image/png'); -$image = CroppedThumbnail($tmp, $box_size, $box_size); +$image = CroppedThumbnail($imagePath, $box_size, $box_size); imagepng($image); imagedestroy($image); diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 447174e84c0..dfb9edebfea 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -82,7 +82,8 @@ class OC_Gallery_Scanner { $file_count = min(count($files), 10); $thumbnail = imagecreatetruecolor($file_count*200, 200); for ($i = 0; $i < $file_count; $i++) { - CroppedThumbnail(OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/files/'.$files[$i], 200, 200, $thumbnail, $i*200); + $imagePath = OC_Filesystem::getLocalFile($files[$i]); + CroppedThumbnail($imagePath, 200, 200, $thumbnail, $i*200); } imagepng($thumbnail, OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/' . $albumName.'.png'); }