"Ruby Tuesday" <ru*********@yahoo.com> wrote in message
news:c4*************@ID-205437.news.uni-berlin.de...
How do I find the information about an image, e.g. its dimension, whether
it's jpg, tiff, bmp, gif, etc using the
native PHP function? I know that we can do it by using the imagemagick,
but perhaps some webhosting site does not have that installed. Thanks
You might start with the manual:
http://us2.php.net/manual/en/ref.image.php
Here's a script you can tinker with to get started:
<?PHP
// Capture GET parameters
$source_file = $_GET['image'];
$new_width = $_GET['width'];
$new_height = $_GET['height'];
// Open source image file and get image dimensions
$old_image = imagecreatefromjpeg($source_file);
$old_width = imagesx($old_image);
$old_height = imagesy($old_image);
// Create blank image
$new_image = imagecreatetruecolor($new_width,$new_height);
// Copy and resize old image into new image resource and then return to
browser
imagecopyresized($new_image,$old_image,0,0,0,0,$ne w_width,$new_height,$old_w
idth,$old_height);
header('Content-type: image/jpeg');
imagejpeg($new_image);
?>
Called with:
<img src="imagethumb.php?image=test.jpg&width=100&heigh t=75" ... />
Steve
--
Steven C. Gallafent - The Computer Guy
st***@compguy.com -
http://www.compguy.com/
Have you tried
http://www.pairusers.com/? I did. It's nifty!