PHP Classes

PHP Resize Image on the fly: Serve resize image from given URL on the fly

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (4 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 725 This week: 3All time: 4,576 This week: 154Up
Version License PHP version Categories
resize-on-the-fly 1.10GNU General Publi...5.3PHP 5, Graphics
Description 

Author

This class can serve resize image from given URL on the fly.

It can take the URL of a given image and retrieve its contents to a local file.

The class can resize the image to a given size using the convert program and serves it as the current script output.

If it is not possible to serve the requested resized image, it serves a default image.

Picture of Hemant Kumar Tiwary
  Performance   Level  
Name: Hemant Kumar Tiwary <contact>
Classes: 2 packages by
Country: India India
Innovation award
Innovation award
Nominee: 1x

Example

<html>

    <body>

    <p>
        <h3>Author : Hemant Kr Tiwari<br/>
        Email : t.hemantkumar@gmail.com<br/>
        Blog : http://hemant-uniquescience.blogspot.in/<br/>
        Licence : GNU General Public License
        </h3>
    </p>

    <p>
        This example is used to resize the image i,e.
        Take the image from URL = http://texipaleo.files.wordpress.com/2014/01/cropped-cropped-cropped-cropped-blogheader4.jpg
        AND resize with size of width=200 and height=200
        <img src='http://localhost/resizer.php?url=http://texipaleo.files.wordpress.com/2014/01/cropped-cropped-cropped-cropped-blogheader4.jpg&size=200x200-S' />


    </p>
<br/>

     <p>
                This example is used to resize the image i,e.
                Take the image from URL = http://texipaleo.files.wordpress.com/2014/01/cropped-cropped-cropped-cropped-blogheader4.jpg
                AND resize with size of width=200 and height=200
                <img src='http://localhost/resizer.php?url=http://texipaleo.files.wordpress.com/2014/01/cropped-cropped-cropped-cropped-blogheader4.jpg&size=200x200-PC' />

        </p>

    </body>

</html>


Details

Author : Hemant Kr Tiwari Email : t.hemantkumar@gmail.com Contact : +91-9818664766 Blog : http://hemant-uniquescience.blogspot.in/ Licence : GNU General Public License This Class is used to resize the image on fly. it doesn't store the resize image Requirement: 1. ImageMagick Version: ImageMagick 6.6.9-7 2. PHP CURL enable Replace in resizer.php class 1. "NO_THUMB_IMAGE_URL" to "Your server no thumb URL" define('NO_THUMB_IMAGE_URL', 'http://www.cricketworldcupt20.com/wp-content/themes/sw_go/assets/img/no-thumbnail.png'); How to use <img src='http://localhost/resizer.php?url=http://texipaleo.files.wordpress.com/2014/01/cropped-cropped-cropped-cropped-blogheader4.jpg&size=200x200-S /> Where http://localhost/resizer.php : it is the server url url & size are the parameter. url : The image path which get resize. size : size in width and height of resize image. example : size = 200x200-S : it will resize the image without keeping aspect ratio. size = 200x200-PC : It will resize image and then crop it.

  Files folder image Files  
File Role Description
Accessible without login Plain text file README Doc. contain requirement
Accessible without login Plain text file example.php Example sample code
Accessible without login Plain text file README.md Doc. Documentation
Plain text file resizer.php Class main class

 Version Control Unique User Downloads Download Rankings  
 25%
Total:725
This week:3
All time:4,576
This week:154Up