PHP Classes
elePHPant
Icontem

classImg: A simple class to manage images

Recommend this page to a friend!
  Info   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2003-03-07 (14 years ago) RSS 2.0 feedStarStarStar 42%Total: 4,610 This week: 1All time: 586 This week: 547Up
Version License Categories
classimg 1.0GNU General Publi...Databases, Graphics
Description Author

This class uses a database table to store images. Is very simple. Has only one public property, and only 6 methods not including the constructor. It makes use of the classMySQL as the database abstraction layer.

  Performance   Level  
Name: Daniel Andres Marjos <contact>
Classes: 13 packages by
Country: Argentina Argentina
Innovation award
Innovation award
Nominee: 2x

Details
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.
  Files folder image Files  
File Role Description
Plain text file classImg.php Class The main file
Accessible without login Plain text file readme.txt Doc. The documentation

 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,610
This week:1
All time:586
This week:547Up
 User Ratings  
 
 All time
Utility:62%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:45%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:42%StarStarStar
Rank:2772