PHP Classes

Mr. Thumb PHP Image Resizing: Resize images keeping the original size proportion

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 1,412 All time: 2,762 This week: 206Up
Version Licenses PHP version Categories
mrthumb 1.0Free for non-comm...5.0PHP 5, Graphics
Description 

Author

This class can be used to resize images keeping the original size proportion.

It can open a given image in GIF, JPEG, PNG, BMP and WBMP formats.

The class can resize the image to a given size keeping the original proportion between width and the height.

The resize image can be saved to a file or served as the current script output.

Picture of Jordan Thompson
Name: Jordan Thompson <contact>
Classes: 1 package by
Country: United States United States

Example

<?php

   
include './mrthumb.class.php';
       
   
// The image you are resizing. Can be a local path as well.
   
$image = 'http://jordan.rave5.com/imgarch/clock.gif';

   
$quality = 100; // percent
   
    // In this example we are resizing the image in proportionate sizes.
    // Below we are specifying the MAX width and height.
   
$width = 100; // Pixels
   
$height = 130; // Pixels

    // Start Mr. Thumb v1.0
   
$mrthumb = new MrThumb();
   
   
// Render the image
   
$mrthumb->render( $image );
   
   
// Resize the image proportionately
    // $mrthumb->constrain( $width, $height );
   
$mrthumb->proportion( $width, $height );

   
// Finally, output the image to the browser!
    // Optionally we can save the image to a destination
    // $mrthumb->saveto( $destination, $filename, $quality );
   
$mrthumb->output( $quality );
   
   
// Clean up after you are done! ;)
   
$mrthumb->clear_cache();
   
?>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file mrthumb.class.php Class Mr. Thumb Class
Accessible without login Plain text file example.php Example Example of Mr. Thumb

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,412
This week:0
All time:2,762
This week:206Up