Fix failed MNGs imagesize detection (existing basename-matching GIF expected)
[www.energie.vellum.cz.git] / common.php
index a8f4d00..7644141 100644 (file)
@@ -182,7 +182,7 @@ function img_size($width,$height)
 
 function img($file,$alt,$attrs="")
 {
-       list($width,$height)=getimagesize($file);
+       list($width,$height)=getimagesize(ereg_replace("\\.mng",".gif",$file));
        $alt=htmlspecialchars($alt);
        return("<img src=\"$file\" alt=\"$alt\" title=\"$alt\" ".img_size($width,$height)
                        .($attrs=="" ? "" : " ".$attrs)." />");
@@ -190,7 +190,8 @@ function img($file,$alt,$attrs="")
 
 function gsm_banking()
 {
-       return(img("img/sluzby_bankovni_pggsm.gif","Paegas GSM banking","class=\"img-align\""));
+       return(img("img/sluzby_bankovni_pggsm.".(image_supported("video/x-mng") ? "mng" : "gif"),
+                       "Paegas GSM banking","class=\"img-align\""));
 }
 
 function price_a()
@@ -388,14 +389,15 @@ zvolte pros
 
 <li>
 <table border="0">
-<tr><td><?php print("<a href=\"$base.pdf\">".img("img/adobe-pdficon-alpha.gif","Adobe PDF")."</a>"); ?></td>
+<tr><td><?php print("<a href=\"$base.pdf\">".img("img/adobe-pdficon-alpha.".(image_supported("image/png") ? "png" : "gif"),
+                       "Adobe PDF")."</a>"); ?></td>
        <td><?php print(data_href("$base.pdf","Dokument PDF")); ?></td>
        </tr>
 </table>
 <blockquote>
 <table border="0">
 <tr><td><a href="http://www.adobe.com/products/acrobat/readstep.html"><?php
-       print(img("img/adobe-getacro.gif","Get Adobe Acrobat Reader"));
+       print(img("img/adobe-getacro.".(image_supported("image/png") ? "png" : "gif"),"Get Adobe Acrobat Reader"));
        ?></a></td>
        <td class="smaller">Soubor je ve formátu <span class="italic">Adobe Acrobat</span>,
        pro jeho pøeètení si prosím nainstalujte