suggest an alternate to getimagesize() in JS or PHP
For reasons unknown to mankind, I have been forbidden to use getimagesize()
, is there any better alternate to getimagesize()
which can handle timeouts if I open a开发者_C百科 remote image? I am also looking at JS options
Server guys tell me allow_url_fopen
is turned off. I didn't check it :( My fault.
A JS solution would be to load the image into some hidden <img>
-tag, attach a JS callback on the onload
event, check the image size in there, do the appropriate resizing and move the <img>
-node into the correct place in your DOM tree.
Use Imagick? It has many advanced functions as well as getImageSize(). Documentation sucks, but in this case, there are some comments that demonstrate it's use.
None of these functions will work with remote files (as far as I know) so you should download them and than work with them.
http://www.php.net/manual/en/function.exif-read-data.php
精彩评论