Login   Register  
PHP Classes
elePHPant
Icontem

File: how_to_2.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_2.txt  >  Download  
File: how_to_2.txt
Role: Example script
Content type: text/plain
Description: How to use this class reading a JPG image from POST
Class: Images
Manipulate JPEG image files uploaded via Web forms
Author: By
Last change:
Date: 2004-05-31 15:16
Size: 651 bytes
 

Contents

Class file image Download
<?php
/*
HOW TO USE THIS CLASS:

//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 FROM POST
// load the class
$img = new images();
// open a file
$img->getImageFromPost("NAME_OF_FORM_ELEMENT");
// 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");
*/
?>