Hi,
try following:
$PicPathIn="../bilder/";
$PicPathOut="../bilder/out/";
// Picture
$bild="Foto.jpg";
$neueBreite=100; //New width
$size=getimagesize("$PicPathIn"."$bild");
$breite=$size[0];
$hoehe=$size[1];
$neueHoehe=intval($hoehe*$neueBreite/$breite);
if($size[2]==1) {
// GIF
$altesBild=ImageCreateFromGIF("$PicPathIn"."$bild");
$neuesBild=ImageCreate($neueBreite,$neueHoehe);
ImageCopyResized($neuesBild,$altesBild,0,0,0,0,$neueBreite,
$neueHoehe,$breite,$hoehe);
ImageGIF($neuesBild,"$PicPathOut"."TN"."$bild");
}
if($size[2]==2) {
// JPG
$altesBild=ImageCreateFromJPEG("$PicPathIn"."$bild");
$neuesBild=ImageCreate($neueBreite,$neueHoehe);
ImageCopyResized($neuesBild,$altesBild,0,0,0,0,$neueBreite,
$neueHoehe,$breite,$hoehe);
ImageJPEG($neuesBild,"$PicPathOut"."TN"."$bild");
}
if($size[2]==3) {
// PNG
$altesBild=ImageCreateFromPNG("$PicPathIn"."$bild");
$neuesBild=ImageCreate($neueBreite,$neueHoehe);
ImageCopyResized($neuesBild,$altesBild,0,0,0,0,$neueBreite,
$neueHoehe,$breite,$hoehe);
ImagePNG($neuesBild,"$PicPathOut"."TN"."$bild");
}
echo "Old Picture: <BR>";
echo "<IMG SRC=\"$PicPathIn$bild\" WIDTH=\"$breite\" HEIGHT=\"$hoehe\">
<BR><BR>";
echo "New Picture:<BR>";
$Tumbnail=$PicPathOut."TN".$bild;
echo "<IMG SRC=\"$Tumbnail\" WIDTH=\"$neueBreite\" HEIGHT=\"$neueHoehe\">";
firemouse2001