PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
speedy33417
Forum Contributor
Posts: 128 Joined: Sun Jul 23, 2006 1:14 pm
Post
by speedy33417 » Wed Sep 20, 2006 2:51 pm
I have the following code to display some thumb pictures
Code: Select all
echo "<img border=\"0\" src=\"http://www.mysite.com/album/pics/" . $result['picture_filename'][$currentpic] . "-thumb.jpg\" width=\"150\" height=\"113\"><br>" . "\n";
I use mostly 640x480 pictures with 150x113 thumb pictures. Key word being mostly. I just realized that my pictures could be portrait or landscape or in rare cases the proportion could be different. I'd hate to do it without width and height values, because until the picture is totally downloaded the browser doesn't keep the required space open for it, shifting the set up of my page until all the thumbs are done downloading.
How do I get these values for a picture?
Thanks.
speedy33417
Forum Contributor
Posts: 128 Joined: Sun Jul 23, 2006 1:14 pm
Post
by speedy33417 » Wed Sep 20, 2006 3:09 pm
Does that mean that there is no php code to do it without an open source application?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Wed Sep 20, 2006 3:11 pm
a) php itself is open source, so the answer must be "No?"
b)
SpecialK
Forum Commoner
Posts: 96 Joined: Mon Sep 18, 2006 3:49 pm
Post
by SpecialK » Wed Sep 20, 2006 3:11 pm
The GD library is for use with PHP. I would call it more of an extension then another application.
I could have used it a few times already, but my manager didnt want to use it which restricted what could be done.
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Wed Sep 20, 2006 5:42 pm
SpecialK wrote: I could have used it a few times already, but my manager didnt want to use it which restricted what could be done.
Why on Earth is your manager making development decisions? Everyone should use GD whereever it's applicable. Coz it's ace. I am not biased at all.
n00b Saibot
DevNet Resident
Posts: 1452 Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:
Post
by n00b Saibot » Wed Sep 20, 2006 9:48 pm
if your manager is biased try
ImageMagick instead and use it to grow horns on your manager
speedy33417
Forum Contributor
Posts: 128 Joined: Sun Jul 23, 2006 1:14 pm
Post
by speedy33417 » Thu Sep 21, 2006 7:42 am
For those of you who's looking for a code to get the size of an image this is what I ended up with:
Code: Select all
$size = getimagesize("images/pic.jpg");
$width = $size[0];
$height = $size[1];
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Thu Sep 21, 2006 8:01 am
That $size array is superfluous.
Code: Select all
list($width,$height) = getimagesize("images/pic.jpg");
Does the same thing.