I have a script below that resizes a jpg images. Currently only jpg files work. Can anyone tell me how to get .gif, .png, and possibly .tif and .pdf pictures to work in this script.
Thanks!
<?php
// The file
$filename = $_REQUEST[‘photo’];
$wid=625;
// Content type
header(‘Content-type: image/jpeg’);
header(‘Content-length: ‘.filesize($filename));
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $wid;
$widthratio = $new_width / $width;
$new_height = $height * $widthratio;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
?>