Login   Register  
PHP Classes
elePHPant
Icontem

File: README

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of dennis iversen  >  ScaleImage  >  README  >  Download  
File: README
Role: ???
Content type: text/plain
Description: A README file with usage examples
Class: ScaleImage
Easy scaling of images with GD
Author: By
Last change:
Date: 12 years ago
Size: 1,342 bytes
 

Contents

Class file image Download
$Id: README,v 1.2 2002/05/24 20:38:04 dennis Exp $

A small class for scaling/transforming images. Testet with jpeg/png
Requires GD >= 2.0.1

USAGE

include the class:
include_once "path/to/includes/ScaleImage/ScaleImage.php"

The following will open a image from an URL and scale it 50%, and then send
the image to the browser, including the correct headers. It guesses that the
image is a png and sends the headers and the image stream.

$Scale= new ScaleImage("http://host.com/image.png");
$Scale->scalePercentage(50);

you can always set or change the quality of scaled jpg's
$Scale->quality=75;

The next example will scale the image and copy it to another file on the file system.
It also transform the image from png to jpg. The new image will have a max width of
150

$Scale= new ScaleImage("/home/user/image.png");
$Scale->scaleMaxWidth(150, "/home/user/new_image.jpg", "jpg");

MaxHeight 150:
$Scale= new ScaleImage("/home/user/image.png");
$Scale->scaleMaxHeight(150, "/home/user/new_image.jpg", "jpg");

scale the largest of x or y to 150:
$Scale= new ScaleImage("/home/user/image.png");
$Scale->scaleXorY(150, "/home/user/new_image.jpg", "jpg");

ordinary scaling specifing x and y:
$Scale= new ScaleImage("/home/user/image.png");
Scale->scaleXY(150, 250 "/home/user/new_image.jpg", "jpg");