Re: Finding the height of a JPG in pixels using PHP
| From: | De deco | Date: | Sun, 06 Apr 2003 04:51:36 +0000 |
| Subject: | Re: Finding the height of a JPG in pixels using PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-142571@lists.php.net to get a copy of this message | ||
<snip from "Andrew Brampton" andrew@bramp.freeserve.co.uk>
You can use getimagesize on a jpg file to read its size, so either
save the jpg in MySQL to a file and then do a getImageSize, or before you place the jpg in to the
database read its size and store its dimensions with it in the db.
</>
I disagree with Andrew. In my humble opinion, I don't think you need to duplicate information.
Before you decide, have a better viewing of the problem.
Not a good solution for me.
I know little about JPEG files, but I know they have a HEADER. This header may contain the value
(binary, o' course) you need, and even more info than you think. :) So, search a for JPG
file's spec before you continue. Very easy to find.
After you know about the files you work with, you have to know how to tell PHP to do what you want
to do. I am not a good person to tell you that, as I am such a newbie to PHP. I can only tell that
this would be "pisso chocka cake" in assembly. (VERY VERY easy =)
<snip from "Phil Schwarzmann" phil.schwarzmann@filanya.com>
I have JPG files stored as binary in a MySQL database. I am
displaying the JPGs on the screen and also want to know the height (in pixels) of the JPG.
</>
Another solution would be if PHP *already* has integrated processing of JPG files, wich maybe true,
judging by the intricate relation of PHP and internet, and JPG being this commom. I think a file
extension wouldn't stand in the way (wich I think is what you, Phil, meant by "stored as
binary" - no extension) Just check that.
Also, Phil, snipets of the code you use, help you and us much better.
Regards,
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup