PHP Classes

PHP Image cURL: Emulate getimagesize function remotely using cURL

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-10-02 (25 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 577 This week: 1All time: 5,079 This week: 1,016Up
Version License PHP version Categories
image-curl 2.0.3Custom (specified...5.4PHP 5, Graphics, Files and Folders, W...
Description Author

This class can emulate getimagesize function remotely using cURL.

It can retrieve an image file from a remote server using the cURL extension to send HTTP requests to that server.

The class implements a function as a wrapper for the PHP getimagesize method by retrieving the image file and calling getimagesize to get the image size and image type metadata of images retrieved from remote servers so it will work on PHP environments on which fopen wrappers are disabled in the PHP configuration.

Besides the original getimagesize function metadata, it also returns the image file size.

Innovation Award
PHP Programming Innovation award nominee
May 2014
Number 2

Prize: One copy of the Zend Studio
The getimagesize function is very useful to get the dimensions of images read from local or remote files.

However, if the fopen wrappers are disabled in the current PHP configuration, getimagesize cannot get the dimensions of remote images.

This class implements an alternative solution that relies only on the cURL extension.

Manuel Lemos
Picture of Mike Jordan
  Performance   Level  
Name: Mike Jordan <contact>
Classes: 5 packages by
Country: United States United States
Age: 53
All time rank: 1569213 in United States United States
Week rank: 295 Up29 in United States United States Up
Innovation award
Innovation award
Nominee: 1x

App:       Image cURL
Version:   2.1.0
Author:    MT Jordan <>
Copyright: 2016
License:   zlib/libpng License


Image cURL: Image class to emulate the getimagesize() function using the cURL library

Image cURL is a class that utilizes the cURL library as a handler for HTTP requests for 
remote images where web hosts have disabled the fopen wrappers.  Additionally, the image 
filesize is returned. This class is useful when requiring metadata from remote linked images 
to check filesizes and image dimensions for publishing restrictions.


Image cURL Features:

    * Alternate method for the getimagesize function where the fopen wrappers are disabled.

Image cURL Restrictions:

    *  Image path MUST be a fully qualified URL.
    *  Must have permissions to read/write to sys tmp dir
Image cURL Requirements:

    * PHP 5.4+
    * Enabled cURL extension

  Files folder image Files  
File Role Description
Plain text file img_info.php Class Image class to simulate the getimagesize function
Accessible without login Plain text file license.txt Lic. zlib/libpng License
Accessible without login Plain text file readme.txt Data Class Information
Accessible without login Plain text file test_img_info.php Example Demo script

 Version Control Reuses Unique User Downloads Download Rankings  
This week:1
All time:5,079
This week:1,016Up
User Comments (1)