Re: How does one obtain the resolution of an image in PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simon M. Campden-Main wrote:
Good morning, folks.

Can any one direct me to a snippet or suggest an approach to obtaining the
resolution of an image [file] with PHP. exif_read_data() is great if the image was taken with a camera that is exif compliant, but is no help with my scanned
images.  getimagesize() gives me height and width - not much help that I can
see. I want ppi! I've no doubt that this is another case where the answer is
painfully obvious and my mind to dull, but I've spent the better part of the
day searching usenet groups and the PHP docs and come up with naught.
I'm running the current Cent OS distribution of EL, PHP Version 4.3.9 with, of
course, GD support. Any suggestions would be most appreciated.
Thank you.
Simon
simon@xxxxxxxxxxx

There is no way you can do it.
To have on screen e.g. 40 ppi or 80 ppi when the image has a size of 400x400 pixel you would have to read out the image how big a pixel in it is. at 80 ppi you would have your normal image and on 40 ppi the pixels used per dot would be duplicated. you still have 400 pixel in width and you would not be able to "count" the pixels who got duplicated.

If you are lucky it's written in the file. Otherwise no chance.

The normal screen resolution is: with an average of 0.26 mm ~ 3.8 pixel/mm ~ 97 pixel per inch.
No matter what kind of "resolution" you would choose
(800x600,1024x768 etc.)

an image having for example 48ppi would have pixels that use 2x2 pixels (4 pixels) as one colored pixel and so on.

Now guess what you see when you have 194 ppi.
Nothing, it's still 97 ppi because it's not possible for the screen to view anything else. Normally the screen would just duplicate the imagesize from 400x400 to 800x800.

Greets Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux