PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Ciprian Voicu   Pictoru's Thumb   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: the example file
Class: Pictoru's Thumb
Generate thumbnails to GIF, JPEG and PNG images
Author: By
Last change: add an example and of rotation for the last function added
Date: 18 years ago
Size: 1,582 bytes
 

Contents

Class file image Download
<?
# EXAMPLE FILE
/********************************************************************************
* Name: Pictoru's Thumb *
* Author: Ciprian Voicu *
* Version: 1.0 *
* Date: 2006-08-08 *
* Description: • creates, saves, outputs thumbs *
* License: GNU GPL *
********************************************************************************/

include "class.pThumb.php";

$img=new pThumb();

# sets the max width of thumb to 200
$img->pSetWidth(200);

# sets the max height of thumb to 150
$img->pSetHeight(150);

# sets the max width and max height of thumb
$img->pSetSize(250, 200);

# set quality of the output image if jpeg
$img->pSetQuality(100);

# all of them will be overwrited by this function if more than 1 parameter is call
# pCreate(image path, max width, max height, quality)
# max width, max height, quality are optional
# if no image present will be drawn one
$img->pCreate("stutzu.jpg");

# this class rotate the image
# the second parameter is optional. specifies the direction of rotation
# the default is CW. you can set it to CCW either
# ot you can use 1 instead of CW and 2 instead of CCW
# the third parameter is optional. specifies the color of the uncovered zone after the rotation.
$img->pRotate(5);

# save the image
# if the directory is not present will be created
//$img->pSave("image.jpg");

# send the image to browser
# the argument is set to false will promt to download
# ex: $img->pOutput(false);
$img->pOutput();

?>