PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Alfred R. Baudisch   Thumbnails Creation   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Usage example of thumbs class
Class: Thumbnails Creation
Generate smooth thumbnail images
Author: By
Last change: Now it shows other way of using the class.
Date: 20 years ago
Size: 1,067 bytes
 

Contents

Class file image Download
<?php
/**
* Usage example of "thumbs" class.
*/
require "class.thumbs.php";

/**
* Your photos are in the directory "photos".
* The class will generate the thumbnails into the directory> "photos/thumbs/", with the default settings.
*/
$thumbs = new thumbs("./photos/");
$thumbs->creates_thumbs();

/**
* Create grayscale thumbnails
*/
$thumbs->_directory = "./photos/";
$thumbs->_thumbs_directory = "gray/";
$thumbs->_thumbs_name = "_gray";
$thumbs->_gray_scale = true;
$thumbs->creates_thumbs();

exit;

/**
* The class will generate the thumbnails into the directory> "photos/thumbs/".
* And all thumbs will be 120x120 px and JPEG Quality of 50%
*/
$thumbs = new thumbs("photos/", 0, "thumbs/", false, 0, 100, false, 120, 120);
$thumbs->creates_thumbs();

/**
* The class will generate the thumbnails into the directory> "photos/". But the name of they will be:
* "nameoforiginalphoto_thumb.ext", "nameoforiginalphoto2_thumb.ext", etc..
*/
$thumbs = new thumbs("./photos/", false, false, "_thumb");
$thumbs->creates_thumbs();
?>