PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Jordan Thompson   Mr. Thumb PHP Image Resizing   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of Mr. Thumb
Class: Mr. Thumb PHP Image Resizing
Resize images keeping the original size proportion
Author: By
Last change:
Date: 15 years ago
Size: 885 bytes
 

Contents

Class file image Download
<?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();
   
?>