*
* @param integer $width maximum width of the generated thumbnail
* @param integer $height maximum height of the image (optional)
- * @return ThumbnailImage
+ * @return ThumbnailImage or null on failure
* @public
*/
function getThumbnail( $width, $height=-1 ) {
}
else $thumb= NULL; #not a bitmap or renderable image, don't try.
- if( is_null( $thumb ) ) {
- $thumb = $this->iconThumb();
- }
return $thumb;
}
* Returns an object which can return the pathname, URL, and physical
* pixel size of the thumbnail -- or null on failure.
*
- * @return ThumbnailImage
+ * @return ThumbnailImage or null on failure
* @private
*/
function renderThumb( $width, $useScript = true ) {
*
*/
function toHTML() {
- global $wgLang, $wgUser;
+ global $wgLang, $wgUser, $wgIgnoreImageErrors;
$sk = $wgUser->getSkin();
$s .= ($i%4==0) ? '<tr>' : '';
$thumb = $img->getThumbnail( 120, 120 );
- $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
- $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
-
- # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
- # in version 4.8.6 generated crackpot html in its absence, see:
- # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
- $s .= $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div><div class="gallerytext">' . "\n" .
- $textlink . $text . $nb .
- '</div>';
- $s .= "</div></td>\n";
+ if ( !$thumb && $wgIgnoreImageErrors ) {
+ $thumb = $img->iconThumb();
+ }
+ if ( $thumb ) {
+ $vpad = floor( ( 150 - $thumb->height ) /2 ) - 2;
+ $s .= '<td><div class="gallerybox">' . '<div class="thumb" style="padding: ' . $vpad . 'px 0;">';
+
+ # ATTENTION: The newline after <div class="gallerytext"> is needed to accommodate htmltidy which
+ # in version 4.8.6 generated crackpot html in its absence, see:
+ # http://bugzilla.wikimedia.org/show_bug.cgi?id=1765 -Ævar
+ $s .= $sk->makeKnownLinkObj( $nt, $thumb->toHtml() ) . '</div><div class="gallerytext">' . "\n" .
+ $textlink . $text . $nb .
+ '</div>';
+ $s .= "</div></td>\n";
+ } else {
+ # Error during thumbnail generation
+ $s .= '<td><div class="gallerybox" style="height: 152px;">' .
+ #htmlspecialchars( $nt->getText() ) . "<br />\n" .
+ htmlspecialchars( $img->getLastError() ) .
+ "</div><div class=\"gallerytext\">\n" .
+ $textlink . $text . $nb .
+ "</div></td>\n";
+ }
$s .= ($i%4==3) ? '</tr>' : '';
$i++;
}