Michigan web site - $insert = INSERT INTO images (image_caption, image_username, image_date)
$insert = INSERT INTO images (image_caption, image_username, image_date) VALUES ( $image_caption , $image_username , $today ) ; $insertresults = mysql_query($insert) or die(mysql_error()); $lastpicid = mysql_insert_id(); //change the following line: $newfilename = $ImageDir . $lastpicid . .jpg ; //**insert these lines if ($type == 2) { rename($ImageName, $newfilename); } else { if ($type == 1) { $image_old = imagecreatefromgif($ImageName); } elseif ($type == 3) { $image_old = imagecreatefrompng($ImageName); } // convert the image to jpg $image_jpg = imagecreatetruecolor($width, $height); imagecopyresampled($image_jpg, $image_old, 0, 0, 0, 0, $width, $height, $width, $height); imagejpeg($image_jpg, $newfilename); imagedestroy($image_old); imagedestroy($image_jpg); } $url = location: showimage.php?id= . $lastpicid; header($url); //**end of inserted lines } ?>