//make variables available $image_caption = $_POST[ image_caption ]; $image_username = (Starting a web site)
//make variables available $image_caption = $_POST[ image_caption ]; $image_username = $_POST[ image_username ]; $image_tempname = $_FILES[ image_filename ][ name ]; $today = date( Y-m-d ); //upload image and check for image type $ImageDir = c:/Program Files/Apache Group/Apache2/test/images/ ; //**INSERT THIS LINE: $ImageThumb = $ImageDir . thumbs/ ; //**END OF INSERT $ImageName = $ImageDir . $image_tempname; if (move_uploaded_file($_FILES[ image_filename ][ tmp_name ], $ImageName)) { //get info about the image being uploaded list($width, $height, $type, $attr) = getimagesize($ImageName); if ($type > 3) { echo Sorry, but the file you uploaded was not a GIF, JPG, or . PNG file.
; echo Please hit your browser s back button and try again. ; } else { //image is acceptable; ok to proceed //insert info into image table $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(); $newfilename = $ImageDir . $lastpicid . .jpg ; 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); 221 Manipulating and Creating Images with PHP
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.