PHP Classes


Recommend this page to a friend!
  Classes of dennis iversen   ScaleImage   README   Download  
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: 21 years ago
Size: 1,342 bytes


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(""); $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");