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.
|