jherzog Posted November 17, 2005 Share Posted November 17, 2005 Is there a php command that would return the dimensions of an image file?This file is saved in a directory not in a database.I have looked at the function stat() which returns a lot of information on a file but does not return dimensions (which would be specific to image files).I will explain why I want this in case there is an obviously better solution that you know about:I have a page that displays a picture. In theory all of these pictures should be less then 200px wide or they mess up the layout. However, I am building this site for people who are not web/tech savvy. If they were to upload a picture that was too large I don't want it to display. I was thinking an if() test to make sure that the picture is less then 200px wide. But I can do this only if I can retrieve the dimension stats from a file. Since the proportions of all these pictures change I can not define the image dimensions with html (ie width=200px height=200px). If the pictures proportions were not 1 to 1 the image would be distorted. Another reason I can't define the dimensions with HTML is there could be pictures less than 200px wide which I don't want to blow up, I want them to stay smaller. So that is my problem. Again a php function that returns dimensions would be cool but I kind of doubt it exists. Any ideas?Jed Link to comment Share on other sites More sharing options...
maelstorm Posted November 17, 2005 Share Posted November 17, 2005 Hi Check this link. Hope this is what you were looking forhttp://aspn.activestate.com/ASPN/docs/PHP/...timagesize.htmlHTH 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