Hallo,
wie mache ich es, dass ich einen GetImageSize-Error abfange, falls ein Bild nicht verfügbar ist? Also nicht mit @get... sondern mit einer if-Abfrage
habs so probiert, funktioniert aber nicht:
	
							
						
					wie mache ich es, dass ich einen GetImageSize-Error abfange, falls ein Bild nicht verfügbar ist? Also nicht mit @get... sondern mit einer if-Abfrage
habs so probiert, funktioniert aber nicht:
PHP Code:
	
	
    $maxwidth = 500;
    $maxheight = 750;
    if($imagesize = !GetImageSize($pic))
    {
        return "<img src=\"$pic\">";
    }
    else
    {
    $imagewidth = $imagesize[0];
    $imageheight = $imagesize[1];
    if ($imagewidth > $maxwidth)
    {
        $prop=$imagewidth/$imageheight;
        $imagewidth = $maxwidth;
        $imageheight = ceil($imagewidth/$prop);
    }
    if ($imageheight > $maxheight)
    {
        $prop=$imagewidth/$imageheight;
        $imageheight = $maxheight;
        $imagewidth = ceil($imageheight*$prop);
    }
    return "<img src=\"$pic\" width=\"$imagewidth\" height=\"$imageheight\">";
    } 
 
          

 
							
						
Comment