[PHP] How does one obtain the resolution of an image in PHP?

2006-03-16 Thread Simon M. Campden-Main
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
[EMAIL PROTECTED]

 

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



[PHP] How does one obtain the resolution of an image in PHP?

2006-03-16 Thread Simon M. Campden-Main
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
[EMAIL PROTECTED]

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



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

2006-03-16 Thread Simon M. Campden-Main
Thank you for your response, Tedd.

T> There was a discussion on this a few weeks back -- you might look through
the archives.

I'm reasonably certain I saw the thread but it was no help.  I will go back
and review it in case I missed something.

T> However, the bottom line was that images (other than exif notations) do 
not
contain any resolution information because the resolution of any image is up 
to
the method you wish to view it.

Well, there's the meat of it, isn't it?  I wonder how Paint Shop Pro comes 
up
with PPI (Image - Image information).  I have several thousand scanned 
images
with resolution ranging from 72 PPI up to 1200 PPI (As reported by Paint 
Shop
Pro) and want to discard, or more likely tag as rejected, any that suffer a
resolution of less than 150 PPI.  As you might imagine, I find the thought 
of
doing it manually with Paint Shop Pro repugnant.

T> For example, if you take an image that is 1000 x 1000 pixels and wish
to view it at 72 dpi, then the image size will be 13.8 x 13.8 inches.
If you want to view it at 300 dpi, then the image size will be 3.33
by 3.33 inches in size.
Understand?

I think so, but I am a bit dense.  I'm not concerned with image size but 
rather
native resolution.  Thanks again for taking the time.
Simon
[EMAIL PROTECTED]



"tedd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> >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:
>
> There was a discussion on this a few weeks back -- you might look through 
> the archives.
>
> However, the bottom line was that images (other than exif notations) do 
> not contain any resolution information because the resolution of any image 
> is up to the method you wish to view it.
>
> For example, if you take an image that is 1000 x 1000 pixels and wish to 
> view it at 72 dpi, then the image size will be 13.8 x 13.8 inches. If you 
> want to view it at 300 dpi, then the image size will be 3.33 by 3.33 
> inches in size.
>
> Understand?
>
> tedd
> -- 
> 
> http://sperling.com 

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



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

2006-03-16 Thread Simon M. Campden-Main
Thanks again, Tedd.

I've checked out the links but still no luck.  As I stated (Or implied.)
in my first post, I have played with exif_read_data() but it is of little
use with the scanned images I've examined.  You can see results of my
experiments with  exif_read_data() and getimagesize() at:
http://www.campden-main.com/~orchids/test/test_exif.php

You'll note that if I simply divide the dimensions in pixels by the
dimensions in inches, I'll get the resolution in PPI.  Perhaps the solution
to my problem lies in simply finding a way to obtain the dimensions in 
inches
(As either exif_read_data() or getimagesize() will give me the dimensions in
pixels.) and just do the math.

Again, thanks for your help!
Simon
[EMAIL PROTECTED]

"tedd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Simon:
>
>>Thank you for your response, Tedd.
>
> No problem, glad to help if I can.
>
>>I think so, but I am a bit dense.  I'm not concerned with image size but
>>rather
>>native resolution.  Thanks again for taking the time.
>>Simon
>
> Yes, but that's a different question.
>
> On one hand, you have an image that can be presented in numerous 
> resolutions.
>
> On the other hand, how was the image first obtained?
>
> Some images contain that information, but it's defined by the device that 
> captured the image, for example:
>
> http://www.exif.org/samples.html
>
> In that data set is a host of other information, such as shutter-speed, 
> flash, focal-length, camera make, model,  and such. Check out:
>
> http://www.digicamhelp.com/what-is-exif/
>
> If you want to access these data via php, check out:
>
> http://us3.php.net/exif
>
> But understand, not all images contain that information.
>
> HTH's
>
> tedd
>
> -- 
> 
> http://sperling.com 

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



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

2006-03-17 Thread Simon M. Campden-Main
Good morning, Edwin.

Thank you very much for taking the time to respond to my
query.

E> See if you have ImageMagick installed.

I didn't, but do now.

E> You could probably use the "identify" command to find
the info you need. For more information:
  $ man identify

It works, Edwin.  A tad slow (3 seconds to process a 762k
jpg), but the -verbose option does provide Resolution in
PPI.

E> Of course, this solution is not *in* PHP but you can
invoke that program inside your PHP scripts (^_-)

Indeed!  For those following this thread, you can see the
various outputs at:
http://www.campden-main.com/~orchids/test/test_exif_2.php

Thanks to all and, until the next time, Take Care!
Simon
[EMAIL PROTECTED]

"- Edwin -" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi!
>
> On Thu, 16 Mar 2006 08:13:41 -0800
> "Simon M.  Campden-Main" <[EMAIL PROTECTED]> wrote:
>
>> [ . . . ]
>> I want ppi!
>> [ . . . ]
>> I'm running the current Cent OS
>> [ . . . ]
>
> See if you have ImageMagick installed. You could
> probably use the "identify" command to find the
> info you need. For more information:
>
>  $ man identify
>
> Of course, this solution is not *in* PHP but you can
> invoke that program inside your PHP scripts (^_-)
>
> HTH,
>
> - Edwin -
>
> -- 
> "Happy are the mild-tempered ones,
> since they will inherit the earth." - Matthew 5:5 

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