From: Jens Frank Date: Sun, 8 Feb 2004 23:32:56 +0000 (+0000) Subject: Removed thumb area restriction code, added code to chck for zero-sized thumbnails X-Git-Tag: 1.3.0beta1~1001 X-Git-Url: http://git.cyclocoop.org///%22%40url%40//%22?a=commitdiff_plain;h=b6927811dce29c610aa5c07ca981df8699a518c4;p=lhc%2Fweb%2Fwiklou.git Removed thumb area restriction code, added code to chck for zero-sized thumbnails --- diff --git a/includes/Skin.php b/includes/Skin.php index d495666a72..3ef1ca64ac 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1527,7 +1527,7 @@ class Skin { if ( $wgUseImageMagick ) { # use ImageMagick $cmd = $wgImageMagickConvertCommand . - " -quality 95 -geometry {$width} ". + " -quality 85 -geometry {$width} ". escapeshellarg($imgPath) . " " . escapeshellarg($thumbPath); $conv = shell_exec( $cmd ); @@ -1585,6 +1585,16 @@ class Skin { } + # + # Check for zero-sized thumbnails. Those can be generated when + # no disk space is available or some other error occurs + # + $thumbstat = stat( $thumbPath ); + $imgstat = stat( $imgPath ); + if( $thumbstat["size"] == 0 ) + { + unlink( $thumbPath ); + } } return $thumbUrl; @@ -1601,18 +1611,13 @@ class Skin { $label = htmlspecialchars( $label ); list($width, $height, $type, $attr) = getimagesize( $path ); - $cwidth = $boxwidth; - $cheight = intval( $height/($width/$cwidth) ); - if ($cheight > $boxwidth*1.5) { - $cheight = $boxwidth*1.3; - $cwidth = intval( $width/($height/$cheight) ); - } - if ( $cwidth > $width ) { - $cwidth = $width; - $cheight = $height; + $boxheight = intval( $height/($width/$boxwidth) ); + if ( $boxwidth > $width ) { + $boxwidth = $width; + $boxheight = $height; } - $thumbUrl = $this->createThumb( $name, $cwidth ); + $thumbUrl = $this->createThumb( $name, $boxwidth ); $u = wfLocalUrlE( $link ); @@ -1620,7 +1625,7 @@ class Skin { $s = "
" . "" . - "\"{$label}\"" . + "\"{$label}\"" . "" . "\"{$more}\"" . "

{$label}

";