Hope this help you.......
Supposing your image is in /foto/1.imm
You'll have the new image in /foto/piccole/1.imm
So create the directory or change my code!
$perocrsofoto="1"; //Change it for another image......
$originalfil="foto/".$percorsofoto.".imm";
$seis = getImageSize($originalfil);
if ($seis[1]!=0 && $seis[0]!=0)
{
$original = imagecreatefromjpeg($originalfil);
// Specify height and width of your thumbnail
$h = 67;
$w = 100;
$xyrelation = $seis[0] / $seis[1];
$maalestokk = $seis[1] / $h;
$br = round($seis[0] / $maalestokk);
if ($br > $w) {
$br = $w;
$h = round($br / $xyrelation);
}
$thumb = imagecreatetruecolor($br, $h);
imagecopyresampled ( $thumb, $original, 0, 0, 0, 0, $br, $h, $seis[0], $seis[1]);
imagetruecolortopalette ( $thumb, false, 64); // reduces color depth so that the png output file is smaller. Note that the png thumbnails are MUCH smaller than jpegs of the same pixel size!
ImagePng($thumb,"foto/piccole/".$percorsofoto.".imm");
}