thanks, here is the code.....
function do_upload($userfile,$image_name) {
$file = basename($userfile);
$img_data=getimagesize($userfile);
$src_w=$img_data[0];
$src_h=$img_data[1];
$src_img2=ImageCreateFromJPEG($userfile) or die ("Cannot open source");
if ($src_w < $src_h) {
$new_wl = 360;
$new_hl = 480;}
else {
$new_wl = 480;
$new_hl = 360; }
$dst_img2=imagecreate($new_wl,$new_hl);
imagecopyresized($dst_img2,$src_img2, 0, 0, 0, 0, $new_wl, $new_hl, $src_w, $src_h);
chdir("/home/virtual/site42/fst/var/www/html/ppantiques/stock");
if ( file_exists($image_name) )
{
unlink($image_name);
}
imagejpeg($dst_img2,$image_name);
ImageDestroy($src_img2);
ImageDestroy($dst_img2);
}
function do_upload_thumb($userfile,$image_name) {
$file = basename($userfile);
$img_data=getimagesize($userfile);
$src_w=$img_data[0];
$src_h=$img_data[1];
$src_img=ImageCreateFromJPEG($userfile) or die ("Cannot open source");
if ($src_w < $src_h) {
$new_w = 90;
$new_h = 120;}
else {
$new_w = 160;
$new_h = 120;}
$dst_img=imagecreate($new_w,$new_h);
$dst_img_large=imagecreate($new_wl,$new_hl);
imagecopyresized($dst_img,$src_img, 0, 0, 0, 0, $new_w, $new_h, $src_w, $src_h);
chdir("/home/virtual/site42/fst/var/www/html/ppantiques/stock/thumbnails");
if ( file_exists($image_name) )
{
unlink($image_name);
}
imagejpeg($dst_img,$image_name);
ImageDestroy($src_img);
ImageDestroy($dst_img);
}