$original_height ){ $new_width = $thumbnail_width; $new_height = intval($original_height*$new_width/$original_width); } else { $new_height = $thumbnail_height; $new_width = intval($original_width*$new_height/$original_height); } $dest_x = intval(($thumbnail_width - $new_width) / 2); $dest_y = intval(($thumbnail_height - $new_height) / 2); if($arr_image_details[2]==1) { $imgt = "ImageGIF"; $imgcreatefrom = "ImageCreateFromGIF"; } if($arr_image_details[2]==2) { $imgt = "ImageJPEG"; $imgcreatefrom = "ImageCreateFromJPEG"; } if($arr_image_details[2]==3) { $imgt = "ImagePNG"; $imgcreatefrom = "ImageCreateFromPNG"; } if( $imgt ) { $old_image = $imgcreatefrom("$updir"."$img"); $new_image = imagecreatetruecolor($thumbnail_width, $thumbnail_height); imageCopyResized($new_image,$old_image,$dest_x, $dest_y,0,0,$new_width,$new_height,$original_width ,$original_height); $imgt($new_image,"$updir"."$thumb_preword"."$img") ; } } ################################# UPLOAD IMAGES foreach($_FILES as $k => $v){ $img_type = ""; ### $htmo .= "$k => $v"; ### print_r($_FILES); if( !$_FILES[$k]['error'] && preg_match("#^image/#i", $_FILES[$k]['type']) && $_FILES[$k]['size'] < 1000000){ $img_type = ($_FILES[$k]['type'] == "image/jpeg") ? ".jpg" : $img_type ; $img_type = ($_FILES[$k]['type'] == "image/gif") ? ".gif" : $img_type ; $img_type = ($_FILES[$k]['type'] == "image/png") ? ".png" : $img_type ; $img_rname = $_FILES[$k]['name']; $img_path = $upload_dir.$img_rname; copy( $_FILES[$k]['tmp_name'], $img_path ); if($enable_thumbnails) make_thumbnails($upload_dir, $img_rname); $feedback .= "Image and thumbnail created $img_rname
"; } } ############################### HTML FORM while($i++ < $upload_image_limit){ $form_img .= 'Image '.$i.':
'; } $htmo .= ' '.$feedback.' '.$form_img.'
Powered by Cafe Webmaster '; echo $htmo;