How To Find Image Dimensions Size Of Uploaded File With Php Imagemagick
Post Description: how to find image dimensions size of uploaded file with php imagemagick
how, to, find, image, dimensions, size, of, uploaded, file, with, php, imagemagick
This Post Has Been Viewed 308 Times Since Fri Feb 29, 2008 12:01 pm Posted By clovis with 1 replies
POST# 405
Posted On: Fri Feb 29, 2008 12:01 pm
Topic: How To Find Image Dimensions Size Of Uploaded File With Php Imagemagick
hi, i have a script and i want to know how i can find out what are the dimensions of the file when a user has submitted their image (pictures, photos, pics for example) i can use this info to tell the use if i allow it or not.. thanks
Tue May 29, 2007 9:28 pm
1
marcus
Reply #1001
yes, i know what you mean, i wanted to do this and determine what is the size of the picture a visitor submitted through their upload and find out what are the dimensions like the width and the height of the picture. i found this information here:
Digital images and graphics can make web sites more visually appealing and intuitive to navigate. They can serve as extremely concise ways to illustrate ideas, allowing us to replace the proverbial "thousand words" with a single picture. But so many of the images on the Web suffer from a major weakness: they're static. The size, resolution, colors, and other properties that they had when they were first loaded onto the web server do not change.
If your site displays static images, those images cannot be changed in response to the user's interaction with your site, regardless of how valuable that ability might be for your site's users. Even worse, only you are able to change them, and it's a manual process that requires you first to modify the images on your desktop computer, then upload them again to your web server.
Imagine the possibilities that would open up if you could make your web site change the appearance of the images it displayed, based upon input from you, or any other authorized site visitor. We're not just talking about changing an image's location on the page, but such properties as its size, resolution, borders, contrast, and dithering. Imagine being able to automatically rotate an image, flip it around, add tinting, or combine multiple graphics into one.
if you want more information, you will have to visit their site at
http://www.sitepoint.com/article/dynamic-images-imagemagick
and look for where it says:
Once you have created that MagickWand resource and loaded an image, you can find out information about the image, such as its dimensions:
<?php
// script_2.php
$resource = NewMagickWand();
MagickReadImage( $resource, 'image_1.jpg' );
$width = MagickGetImageWidth( $resource );
$height = MagickGetImageHeight( $resource );
echo "Image size, in pixels, is: width $width x height $height";
?>