Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Check for image resolution 19 Apr 2012 17:28 #2063

  • tr4ding
  • tr4ding's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 42
  • Thank you received: 0
Hy everybody and thank you in advance for your great support!!!

I'd like to check not only for extension and size of an image, but also for resolution.....

Looking around I've seen that this code returns width and height of jpg:
$img = @imagecreatefromjpeg('./1.jpg');
$x = ImageSX($img);
$y = ImageSY($img);

How could I implement this solution (presumely in classes/upload.php) in order to check for specific resolutions? (In my case are 640*480 and 800*600).

I hope not boring you.

Thank you!

Please Log in or Create an account to join the conversation.

Re: Check for image resolution 19 Apr 2012 19:45 #2064

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
To do this :

To know the size of the navigator window (not the resolution), you should send the values (x,y) in an url parameter. (You get first these size trough javascript).

Then, you receive them and treat them in order to adjust your thumb sizes.

- If you define predefined fixed sizes (better), you can create cache thumbs.
- If you resize the image to any sizes, you should'nt recreate cache files and directly output the resized image.

Hope it helps.

EDIT : You can store these navigator sizes in session and resend the values throuht AJAX (invisible), anytime that the user resize its window ;-)
Coding is now a piece of cake
The following user(s) said Thank You: tr4ding

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.052 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started