Gallery: Only get local file when generating photo thumbnail

This commit is contained in:
Bart Visscher 2012-02-13 22:39:30 +01:00
parent e137020f67
commit 169ddc5b0b
1 changed files with 4 additions and 5 deletions

View File

@ -67,10 +67,6 @@ class OC_Gallery_Photo {
} }
public static function getThumbnail($image_name) { public static function getThumbnail($image_name) {
$imagePath = OC_Filesystem::getLocalFile($image_name);
if(!file_exists($imagePath)) {
return null;
}
$save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/'; $save_dir = OC_Config::getValue("datadirectory").'/'. OC_User::getUser() .'/gallery/';
$save_dir .= dirname($image_name). '/'; $save_dir .= dirname($image_name). '/';
$image_name = basename($image_name); $image_name = basename($image_name);
@ -78,6 +74,10 @@ class OC_Gallery_Photo {
if (file_exists($thumb_file)) { if (file_exists($thumb_file)) {
$image = new OC_Image($thumb_file); $image = new OC_Image($thumb_file);
} else { } else {
$imagePath = OC_Filesystem::getLocalFile($image_name);
if(!file_exists($imagePath)) {
return null;
}
$image = new OC_Image($imagePath); $image = new OC_Image($imagePath);
if ($image->valid()) { if ($image->valid()) {
$image->centerCrop(); $image->centerCrop();
@ -90,7 +90,6 @@ class OC_Gallery_Photo {
} }
} }
if ($image->valid()) { if ($image->valid()) {
//var_dump($image, $image->resource());
return $image; return $image;
} }
return null; return null;