Index: trunk/phase3/includes/Skin.php |
— | — | @@ -1527,7 +1527,7 @@ |
1528 | 1528 | if ( $wgUseImageMagick ) { |
1529 | 1529 | # use ImageMagick |
1530 | 1530 | $cmd = $wgImageMagickConvertCommand . |
1531 | | - " -quality 95 -geometry {$width} ". |
| 1531 | + " -quality 85 -geometry {$width} ". |
1532 | 1532 | escapeshellarg($imgPath) . " " . |
1533 | 1533 | escapeshellarg($thumbPath); |
1534 | 1534 | $conv = shell_exec( $cmd ); |
— | — | @@ -1585,6 +1585,16 @@ |
1586 | 1586 | |
1587 | 1587 | |
1588 | 1588 | } |
| 1589 | + # |
| 1590 | + # Check for zero-sized thumbnails. Those can be generated when |
| 1591 | + # no disk space is available or some other error occurs |
| 1592 | + # |
| 1593 | + $thumbstat = stat( $thumbPath ); |
| 1594 | + $imgstat = stat( $imgPath ); |
| 1595 | + if( $thumbstat["size"] == 0 ) |
| 1596 | + { |
| 1597 | + unlink( $thumbPath ); |
| 1598 | + } |
1589 | 1599 | |
1590 | 1600 | } |
1591 | 1601 | return $thumbUrl; |
— | — | @@ -1601,18 +1611,13 @@ |
1602 | 1612 | $label = htmlspecialchars( $label ); |
1603 | 1613 | |
1604 | 1614 | list($width, $height, $type, $attr) = getimagesize( $path ); |
1605 | | - $cwidth = $boxwidth; |
1606 | | - $cheight = intval( $height/($width/$cwidth) ); |
1607 | | - if ($cheight > $boxwidth*1.5) { |
1608 | | - $cheight = $boxwidth*1.3; |
1609 | | - $cwidth = intval( $width/($height/$cheight) ); |
| 1615 | + $boxheight = intval( $height/($width/$boxwidth) ); |
| 1616 | + if ( $boxwidth > $width ) { |
| 1617 | + $boxwidth = $width; |
| 1618 | + $boxheight = $height; |
1610 | 1619 | } |
1611 | | - if ( $cwidth > $width ) { |
1612 | | - $cwidth = $width; |
1613 | | - $cheight = $height; |
1614 | | - } |
1615 | 1620 | |
1616 | | - $thumbUrl = $this->createThumb( $name, $cwidth ); |
| 1621 | + $thumbUrl = $this->createThumb( $name, $boxwidth ); |
1617 | 1622 | |
1618 | 1623 | $u = wfLocalUrlE( $link ); |
1619 | 1624 | |
— | — | @@ -1620,7 +1625,7 @@ |
1621 | 1626 | |
1622 | 1627 | $s = "<div class=\"thumbnail-{$align}\" style=\"width:{$boxwidth}px;\">" . |
1623 | 1628 | "<a href=\"{$u}\" class=\"internal\" title=\"{$label}\">" . |
1624 | | - "<img border=\"0\" src=\"{$thumbUrl}\" alt=\"{$label}\" width=\"{$cwidth}\" height=\"{$cheight}\"></a>" . |
| 1629 | + "<img border=\"0\" src=\"{$thumbUrl}\" alt=\"{$label}\" width=\"{$boxwidth}\" height=\"{$boxheight}\"></a>" . |
1625 | 1630 | "<a href=\"{$u}\" class=\"internal\" title=\"{$more}\">" . |
1626 | 1631 | "<img border=\"0\" src=\"{$wgUploadPath}/magnify-clip.png\" width=\"26\" height=\"24\" align=\"right\" alt=\"{$more}\"></a>" . |
1627 | 1632 | "<p>{$label}</p></div>"; |