rim – PHP Remote Image Library
Working on recent home project I found there is no library in PHP to get dimensions of remote images.
So I made rim php library to get type and size of remote images in optimized way.
The easiest way of getting a image dimension is by using getimagesize PHP function.
It has one great fault when working with remote images, whole image must be downloaded in order for getimagesize to read it’s dimensions.
So if you want to find out dimensions of jpeg 2MB in size getimagesize will first download it. There goes bandwidth!
Rim downloads only few byes need to determine image type and dimensions.
Also if you need to get dimensions of lot’s of pictures rim will thread fetch request for further speed increase.
Take a look at this benchmark, fetching image types and sizes of all images on Hot New Releases in Books at amazon.com:
Have fun!
P.S.
Bug reports would be appreciated ;)
3 thoughts on “rim – PHP Remote Image Library”
July 31, 2012 at 17:58
Hey! This is great idea, but it doesn’t mork with SAFE MODE ON. Anyway to make it safe mode friendly? At the moment getimagesize is crazy slow on remote files and not really an option for my project…
Cheers
August 15, 2012 at 13:15
@Marius: if you are on a hosting with safe mode – move now. :)
October 26, 2013 at 15:38
won’t work with the file with force-download
i have reply for your class here:
https://github.com/MatejB/rim/issues/1
you can try