/ Published in: PHP
I edit this from tylerhall on 11/30/-1
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function image($file_temporary, $file_destination, $width, $height, $type = "jpg") { if($image_size[0] > $image_size[1]) { $new_width = $width; $new_height = $image_size[1] * ($new_width / $image_size[0]); } else { $new_height = $height; $new_width = $image_size[0] * ($new_height / $image_size[1]); } case "image/jpeg": break; case "image/gif": break; case "image/png": break; default: echo "The file type {$t} is not supported, please use either jpeg, gif, or png"; break; } imagecopyresampled($thumb, $image, 0, 0, 0, 0, $new_width, $new_height, $image_size[0], $image_size[1]); switch($type) { case "jpg": case "jpeg": //header("Content-type: image/jpeg"); break; case "gif": //header("Content-type: image/gif"); break; case "png": //header("Content-type: image/png"); break; default: echo "The image type {$type} is not supported, please choose another."; break; } return true; }