Login   Register  
PHP Classes
elePHPant
Icontem

File: how_to_1.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gregory Brown  >  Images  >  how_to_1.txt  >  Download  
File: how_to_1.txt
Role: Example script
Content type: text/plain
Description: How to use this class with an JPG image already on the server
Class: Images
Manipulate JPEG image files uploaded via Web forms
Author: By
Last change:
Date: 10 years ago
Size: 630 bytes
 

Contents

Class file image Download
<?php
//include the class
define("IMAGE_MAX_SIZE",1000000);
define("IMAGE_UPLOAD_PATH",rtrim($_SERVER['DOCUMENT_ROOT']),"/")."/images/");

include(
"path/classFileName");

$maxwidth 180;
$maxHeight 160;

// THIS IS AN EXAMPLE USING AN IMAGE ALREADY ON THE SERVER
// load the class
$img = new images();
// open a file
$img->openImage("/disk/images/imageName.jpg");
// make the image fit in a 180x160 space
$img->transformToFit($maxwidth,$maxHeight);
// add a red stroke of 2 pixels to the image
$img->strokeImage(2,"FF0000");
// save the image
$img->saveImage("/disk/images/treatedImages/newName.jpg");
?>