• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get orientation (landscape/ portrait) of image

#1
[eluser]mvdg27[/eluser]
Hi,

Maybe I'm overlooking something in the CI docs (and PHP docs), but is there an easy way to get the orientation of an image?

Basically I want to know whether an uploaded imagefile is portrait or landscape, and then resize it accordingly.

Any ideas?

Thanks!

#2
[eluser]Johan André[/eluser]
If you use CI Upload-library use $this->upload->data() (which returns an array) and check it for key "image_width" and "image_height".

If width > height then image is landscape, if width < height then image is portrait.
If width = height then image is square! Smile

#3
[eluser]mvdg27[/eluser]
Yeap .. The upload library does the trick. I was searching for image_width and image_height in the image library. This works great.

Thanks

#4
[eluser]jdfwarrior[/eluser]
I forgot upload class had it. I knew it was somewhere. I was going to suggest the php getimagesize function.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ¬© 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.