Login   Register  
PHP Classes
elePHPant
Icontem

File: readme.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniel Andres Marjos  >  classImg  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: The documentation
Class: classImg
A simple class to manage images
Author: By
Last change: Added an example on how to use the showImage method
Date: 11 years ago
Size: 1,177 bytes
 

Contents

Class file image Download
This class is very, very simple to use. The constructor has only one parameter: the instance of the classMySQL used in your site.

Let's asume you have included the classMySQL in your script, and properly created an instance to it.

In this example, I'll supose the script is used to grab an image file uploaded by the user, and that the variable used to upload it was $imgsrc.

Examples:

$myImg=new classImageManager($theDBLayer); 
$myImg->addImage($img_src);
echo "The Image was saved with id: ".$myImg->added_image_id;

You can do anything you want with the addid_image_id property. For example, I've used it to store in an articles table the image ID for later retrieval.

Later, you can show the image simply using the method ShowImage:

$myImg=new classImageManager($theDBLayer); 
$myImg->showImage($theID);

Save those lines in a script called something like "showimage.php", and then use the HTML image tag (or the classHTML fnTmg function) to show the image:

<img src="showimage.php?theID=XXX">


---------------------


That's all... simple, clean, quick...

Be sure you are not using any buffering, because the image will not be shown.