From: Jens Frank Date: Sun, 7 Mar 2004 19:40:58 +0000 (+0000) Subject: Create an error warning for thumbnails of non-existing images X-Git-Tag: 1.3.0beta1~845 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=4897565a2e3eeda58e277f9a0b26f08a6534c3ac;p=lhc%2Fweb%2Fwiklou.git Create an error warning for thumbnails of non-existing images --- diff --git a/includes/Skin.php b/includes/Skin.php index 306e81296a..f57466cb14 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1524,8 +1524,13 @@ class Skin { $alt = htmlspecialchars( $alt ); $u = $nt->escapeLocalURL(); - $s = "" . - "\"{$alt}\""; + if ( $url == "" ) + { + $s = str_replace( "$1", $name, wfMsg("missingimage") ); + } else { + $s = "" . + "\"{$alt}\""; + } if ( "" != $align ) { $s = "
{$s}
"; } @@ -1542,7 +1547,13 @@ class Skin { $thumbPath = wfImageThumbDir( $thumbName )."/".$thumbName; $thumbUrl = wfImageThumbUrl( $thumbName ); - if ( (! file_exists( $thumbPath ) && file_exists( $imgPath )) + if ( ! file_exists( $imgPath ) ) + { + # If there is no image, there will be no thumbnail + return ""; + } + + if ( (! file_exists( $thumbPath ) ) || ( filemtime($thumbPath) < filemtime($imgPath) ) ) { # Squid purging if ( $wgUseSquid ) { @@ -1639,7 +1650,12 @@ class Skin { $alt = preg_replace( "/<[^>]*>/", "", $label); $alt = htmlspecialchars( $alt ); - list($width, $height, $type, $attr) = getimagesize( $path ); + if ( file_exists( $path ) ) + { + list($width, $height, $type, $attr) = getimagesize( $path ); + } else { + $width = $height = 200; + } $boxheight = intval( $height/($width/$boxwidth) ); if ( $boxwidth > $width ) { $boxwidth = $width; @@ -1651,13 +1667,19 @@ class Skin { $u = $nt->escapeLocalURL(); $more = htmlspecialchars(wfMsg( "thumbnail-more" )); - - $s = "
" . - "" . - "\"{$alt}\"" . - "" . - "\"{$more}\"" . - "

{$label}

"; + + $s = "
"; + if ( $thumbUrl == "" ) { + $s .= str_replace( "$1", $name, wfMsg("missingimage") ); + } else { + $s .= "" . + "\"{$alt}\"" . + "" . + "\"{$more}\""; + } + $s .= "

{$label}

"; return $s; } diff --git a/languages/Language.php b/languages/Language.php index fcd1371b75..49af2bcaca 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1396,7 +1396,8 @@ amusement.", # Thumbnails -"thumbnail-more" => "Enlarge" +"thumbnail-more" => "Enlarge", +"missingimage" => "Missing image
$1\n" ); diff --git a/languages/LanguageDe.php b/languages/LanguageDe.php index 32decb3bac..f21f71dac2 100644 --- a/languages/LanguageDe.php +++ b/languages/LanguageDe.php @@ -907,6 +907,7 @@ Diskussions-Seite nicht, da schon eine mit dem neuen Titel existiert. Bitte glei "export" => "Seiten exportieren", "exporttext" => "Sie können den Text und die Bearbeitungshistorie einer bestimmten oder einer Auswahl von Seiten nach XML exportieren. Das Ergebnis kann in ein anderes Wiki mit WikiMedia Software eingespielt werden, bearbeitet oder archiviert werden.", "exportcuronly" => "Nur die aktuelle Version der Seite exportieren", +"missingimage" => "Fehlendes Bild
$1\n" ); class LanguageDe extends Language {