Avoid error when no image is provided for cover or thumbnail
This commit is contained in:
parent
9d46c378b9
commit
42306f1e35
|
@ -18,6 +18,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height, $tgtImg, $
|
||||||
default:
|
default:
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
if(!$myImage) exit();
|
||||||
$ratio_orig = $width_orig/$height_orig;
|
$ratio_orig = $width_orig/$height_orig;
|
||||||
|
|
||||||
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
|
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
|
||||||
|
@ -52,8 +53,11 @@ $targetImg = imagecreatetruecolor($numOfItems*$box_size, $box_size);
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
while (($i = $result->fetchRow()) && $counter < $numOfItems) {
|
while (($i = $result->fetchRow()) && $counter < $numOfItems) {
|
||||||
$imagePath = OC::$CONFIG_DATADIRECTORY . $i['file_path'];
|
$imagePath = OC::$CONFIG_DATADIRECTORY . $i['file_path'];
|
||||||
CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size);
|
if(file_exists($imagePath))
|
||||||
$counter++;
|
{
|
||||||
|
CroppedThumbnail($imagePath, $box_size, $box_size, $targetImg, $counter*$box_size);
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-Type: image/png');
|
header('Content-Type: image/png');
|
||||||
|
|
|
@ -21,6 +21,7 @@ function CroppedThumbnail($imgSrc,$thumbnail_width,$thumbnail_height) { //$imgSr
|
||||||
default:
|
default:
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
if(!$myImage) exit();
|
||||||
$ratio_orig = $width_orig/$height_orig;
|
$ratio_orig = $width_orig/$height_orig;
|
||||||
|
|
||||||
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
|
if ($thumbnail_width/$thumbnail_height > $ratio_orig) {
|
||||||
|
@ -50,9 +51,10 @@ $img = $_GET['img'];
|
||||||
|
|
||||||
$tmp = OC::$CONFIG_DATADIRECTORY . $img;
|
$tmp = OC::$CONFIG_DATADIRECTORY . $img;
|
||||||
|
|
||||||
header('Content-Type: image/png');
|
if(file_exists($tmp))
|
||||||
$image = CroppedThumbnail($tmp, $box_size, $box_size);
|
{
|
||||||
|
header('Content-Type: image/png');
|
||||||
imagepng($image);
|
$image = CroppedThumbnail($tmp, $box_size, $box_size);
|
||||||
imagedestroy($image);
|
imagepng($image);
|
||||||
?>
|
imagedestroy($image);
|
||||||
|
}
|
Loading…
Reference in New Issue