1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37: | if(!$breit)$breit=50;
if(!$hoch)$hoch =50;
if($gross)
$breit=$hoch=$gross;
if(!$bild){$bild ="sysimg/error.jpg";$breit=50;$hoch =50;}
if(!file_exists($bild)){$bild ="sysimg/error.jpg";$breit=50;$hoch =50;}
$info = getimagesize($bild);
clearstatcache();
switch($info[2])
{
case 2:
$bildalt=imagecreatefromjpeg($bild);
break;
case 3:
$bildalt=imagecreatefrompng($bild);
break;
case 4:
$bildalt=imagecreatefromwbmp($bild);
break;
default:
$breit=50;$hoch =50;
$bild="sysimg/format.jpg";
$bildalt=imagecreatefromjpeg($bild);
$info = getimagesize($bild);
break;
}
$breitalt=$info[0];
$hochalt=$info[1];
if((ceil($breitalt*$hoch/$hochalt))>=$breit)
$hoch=ceil($hochalt*$breit/$breitalt);
$breit=ceil($breitalt*$hoch/$hochalt);
$bildneu=imagecreatetruecolor($breit,$hoch);
imagecopyresized($bildneu,$bildalt,0,0,0,0,$breit,$hoch,$breitalt,$hochalt);
header("Content-Type: image/jpg");
imagejpg($bildneu);
imagedestroy($bildneu);
imagedestroy($bildalt); |