murfitUK Posted August 5, 2006 Share Posted August 5, 2006 I'm experimenting with php and sql and all that. I think this question is more to do with the html output though.I've got a folder with 30 jpgs in it of varying sizes 01.jpg, 02.jpg etc. Using a php script I've got a left container with thumbnails by specifying width='50' in the img tag, and added a <a href ... for each pic. When clicked, the relevant picture opens up in the right container.Everything works fine but I would like to limit the main container picture to something like 500px to reduce the amount of scrolling that would be needed to view the larger pictures.Setting width='500' is fine for pictures of 500+ pixels, but if a pic is smaller then that it obviously enlarges the picture which results in pixellating.Is there a way to detect the size of an image when calling the file and somehow using it to determine if the width needs to be set egprint "<img src='{$picNum}.jpg' ";if (picWidth>500) print "width='500' ";print "/>";but I don't know how to find the width of the pic.Any suggestions? Is there an easier way of doing it? Link to comment Share on other sites More sharing options...
justsomeguy Posted August 5, 2006 Share Posted August 5, 2006 You would need to use PHP to do this. See this function, there are several examples on the page you can use as well:http://www.php.net/manual/en/function.getimagesize.phpThe function will also return the image type and other file attributes. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now