🌍
English
I am looking at Piwigo in hopes of replacing an old gallery I run, but have run into an issue with importing my old images. When the current thumbnail code runs into a problem, it throws and error with no indication about what file caused the error. While the patch below may not be perfect, it does add the filename of the problem file (allowing the user to fix/remove it), and it will continue processing the rest of the directory when it encounters and error.
The best way to handle the last item in my patch would probably be with a try/catch statement, but I'm not sure if you want to keep Piwigo working in both php4 and php5.
diff -u admin/thumbnail.php.orig admin/thumbnail.php --- admin/thumbnail.php.orig 2011-03-31 09:03:47.000000000 -0700 +++ admin/thumbnail.php 2011-03-31 09:29:22.000000000 -0700 @@ -66,7 +66,7 @@ unset($extension); } - if ( isset( $srcImage ) ) + if ( isset( $srcImage ) && $srcImage != "" ) { // width/height $srcWidth = imagesx( $srcImage ); @@ -142,7 +142,7 @@ // error else { - echo l10n('Picture unreachable or no support')." "; + echo l10n('Picture unreachable or no support')." ($path)"; if ( isset( $extenstion ) ) { echo l10n('for the file format').' '.$extension; @@ -151,7 +151,7 @@ { echo l10n('for this file format'); } - exit(); + return; } } @@ -354,6 +354,11 @@ { list($width, $height) = getimagesize($path); $size = floor(filesize($path) / 1024).' KB'; + if ($size == 0 || $width == 0 || $height == 0) + { + print "ERROR: reading $path\n"; + break; + } $template->append( 'remainings',
Offline