Welcome, Guest
Username: Password: Remember me

TOPIC: Check for image resolution

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

  • tr4ding
  • tr4ding's Avatar
  • Offline
  • Senior Member
  • Posts: 42
  • Karma: 1
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!
The administrator has disabled public write access.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
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
Last Edit: 19 Apr 2012 19:47 by admin.
The administrator has disabled public write access.
The following user(s) said Thank You: tr4ding
Time to create page: 0.066 seconds

Get Started