ok this is the code, hope it helps ;) [code]<?php if(isset($_POST['Submit2'])) { $size = 75; // the thumbnail height $sizel = 300; // the image height $filedir = 'uploaded_images/'; // the directory for the original image $thumbdir = 'uploaded_images/thumbs/'; // the directory for the thumbnail image $prefix = 'thumb_'; // the prefix to be added to the original name $mode = '0666'; $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $userfile_type = $_FILES['image']['type']; if (isset($_FILES['image']['name'])) { $prod_img = $filedir.$userfile_name; $prod_img_thumb = $thumbdir.$prefix.$userfile_name; move_uploaded_file($userfile_tmp, $prod_img); chmod ($prod_img, octdec($mode)); $sizes = getimagesize($prod_img); $aspect_ratio = $sizes[1]/$sizes[0]; //Image resizing if ($sizes[1] <= $size) { $height = $size; $width = abs($height/$aspect_ratio); }else{ $width = $sizes[0]; $height = $sizes[1]; } $destimg=ImageCreateTrueColor($width,$height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $width, $height, $sizes[0], $sizes[1]) or die('Problem In resampling'); ImageJPEG($destimg,$prod_img,75) or die('Problem In saving'); //Thumnail resizing if ($sizes[1] <= $size) { $new_width = $sizes[0]; $new_height = $sizes[1]; }else{ $new_height = $size; $new_width = abs($new_height/$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResized($destimg,$srcimg,0,0,0,0,$new_width,$new_height,ImageSX($srcimg),ImageSY($srcimg)) or die('Problem In resizing'); ImageJPEG($destimg,$prod_img_thumb,50) or die('Problem In saving'); imagedestroy($destimg); } $img_ad_id = $_POST['AdID']; echo " <table width='100%' border='0' cellspacing='1' cellpadding='6'> <tr> <td bgcolor='#FFFFFF'> <a href='".$prod_img."' target='_BLANK'> <img src='".$prod_img_thumb."' width='".$new_width."' height='".$new_height."'> </a><br /> click submit to proceed! <form name='form1' method='POST' action='".$editFormAction."'> <input type='hidden' name='AdPicThumb1' value='".$prod_img_thumb."' /> <input type='hidden' name='AdPic1' value='".$prod_img."' /> <input type='hidden' name='AdID' value='".$img_ad_id."' /> <input type='hidden' name='MM_update' value='form1'> <input type='Submit' name='Submit' value='Submit'> </form> </td> </tr> </table> "; }else{ echo " <table width='100%' border='0' cellspacing='1' cellpadding='6'> <tr> <td bgcolor='#FFFFFF'> <form name='form' method='POST' action='".$_SERVER['PHP_SELF']."' enctype='multipart/form-data'> <input type='file' name='image' size='65'><br /> <input type='hidden' name='AdID' value='".$_GET['AdID']."' /> <input type='Submit' name='Submit2' value='Submit'><br /> </form> </td> </tr> </table> "; } ?>[/code]