how to find image dimensions size of uploaded file with php imagemagick

RegisterLogin
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
Tags: how, to, find, image, dimensions, size, of, uploaded, file, with, php, imagemagick
This Post Was Posted On Feb 29, 2008 By clovis #1246
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
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
marcus
#1682 1
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";
?>
May 29, 2007 Reply Report abuse
©2011 Webune Forums - Sun Dec 18, 2011 3:47 pm
Powered by: Webune Forums V3