rim – PHP Remote Image Library

Author: Matej B. January 16, 2012

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.

Fork it on github

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 ;)

Author
Matej B.
Follow me @matejbaco