From 8b6452fa28fc90c198fb1fcf893fdcbbb1c4019c Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Sun, 6 Jan 2019 07:17:17 +0100 Subject: [PATCH] Vignette thumb not found --- functions.php | 64 ++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/functions.php b/functions.php index f422a5f..e5b59bc 100755 --- a/functions.php +++ b/functions.php @@ -251,8 +251,6 @@ function displayRetina ($file,$album) { global $ppage; - echo "$ppage"; - //preprint($file); /* @@ -276,35 +274,32 @@ function displayRetina ($file,$album) { [title] => 10_2018 ) */ - - if ($ppage == "1") { - $fullpath = "../../zenphoto/"; - } - else { - $fullpath = "../../../zenphoto/"; - } - $name = explode(".", $file['filename']); - - $thumbpath = "../zenphoto/cache/" . $album . "/"; - //$a = $path . $filename; - - $file_sd = $thumbpath . $name[0] . "_200_thumb.jpg"; - $file_hd = $thumbpath . $name[0] . "_400_thumb.jpg"; -//echo $file_sd; -//echo $file_hd; - - /* - $file_sd = $path . $file[0] . "_180_watermark.jpg"; - $file_hd = $path . $file[0] . "_360_watermark.jpg"; - */ + if ($ppage == "1") $fullpath = "../../zenphoto/"; + else $fullpath = "../../../zenphoto/"; + $thumbsize = 200; + $watermark = "thumb"; + + $name = explode(".", $file['filename']); + $thumbpath = "../zenphoto/cache/" . $album . "/"; + $file_sd = $thumbpath . $name[0] . "_" . $thumbsize . "_" . $watermark .".jpg"; + $file_hd = $thumbpath . $name[0] . "_" . ($thumbsize * 2) . "_" . $watermark .".jpg"; + $th_sd = false; - $th_hd = false; - + $th_hd = false; $thumb = array(); - if (file_exists($file_sd)) { + if (file_exists($file_hd)) { + $th_hd = true; + $size_hd = getimagesize($file_hd, $info); + $thumb['hd'] = array( + 'url' => "../../" . $file_hd, + 'width' => $size_hd[0], + 'height' => $size_hd[1] + ); + } + elseif (file_exists($file_sd)) { $th_sd = true; $size_sd = getimagesize($file_sd, $info); $thumb['sd'] = array( @@ -313,13 +308,13 @@ function displayRetina ($file,$album) { 'height' => $size_sd[1] ); } - if (file_exists($file_hd)) { - $th_hd = true; - $size_hd = getimagesize($file_hd, $info); - $thumb['hd'] = array( - 'url' => "../../" . $file_hd, - 'width' => $size_hd[0], - 'height' => $size_hd[1] + else { + $notfound = "../zenphoto/zp-core/images/err-imagenotfound.png"; + $size_sd = getimagesize($notfound, $info); + $thumb['sd'] = array( + 'url' => "../../" . $notfound, + 'width' => $size_sd[0], + 'height' => $size_sd[1] ); } @@ -333,7 +328,6 @@ function displayRetina ($file,$album) { $standard = $thumb['hd']['url'] . ' 400w'; } - $display = '
'; $display .= ''; $display .= '
' . "\r\n"; -//echo "display: " . $display; - return $display; }