PHP Classes

File: example_with_explanations.php

Recommend this page to a friend!
  Classes of Drazen   Thumb-nailit   example_with_explanations.php   Download  
File: example_with_explanations.php
Role: Example script
Content type: text/plain
Description: Example with explanations
Class: Thumb-nailit
Generate size limited thumbnails of a given image
Author: By
Last change:
Date: 18 years ago
Size: 1,155 bytes
 

Contents

Class file image Download
<?
include("thumb-nailit.php");

// name (and path) of the original image that you want to resize (don't forget the path)
$old_name="/path/name.jpg";


// name you want to give to the thumbnail (again - don't forget the path)
$new_name="/path/thumbnail.jpg";


// Wanted size - only the HIGHER value needs to be entered.
//Let's say you have an image that is 1000 x 500 pixels and you need a thumbnail that is 100x50 pixels wide.
//All you enter into "wanted size" is 100. Class will calculate by itself what is the other number (50 in this case).
//Code checks if the image is vertically or horizontally oriented, and applies the "wanted size" to the higher value
//(width if the image is horizontal / height if the image is vertical).

$wanted_size=120;

// Report - tells the class whether or not to display the progress report
// 1 if you want to display the image data (old file size and pixels, new file size and pixels etc...)
// 0 if you don't want any text to be displayed - just silent thumbnailing.
$report=0;


$resizer=new thumbnailit;
$result=$resizer->ResizeImg($old_name,$new_name,$wanted_size,$report);


?>