PHP Classes
elePHPant
Icontem

classImg: A simple class to manage images

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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 (12 years ago) RSS 2.0 feedStarStarStar 42%Total: 4,599 All time: 566 This week: 1,359Down
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.

Picture of Daniel Andres Marjos
Name: Daniel Andres Marjos is available for providing paid consulting. Contact Daniel Andres Marjos .
Classes: 13 packages by
Country: Argentina Argentina
Age: 44
All time rank: 231 in Argentina Argentina
Week rank: 333 Down2 in Argentina Argentina Down
Innovation award
Innovation award
Nominee: 2x

Details provided by the author  
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,599All time:566
 This week:0This week:1,359Down
 User Ratings  
 
 All time
Utility:62%StarStarStarStar
Consistency:66%StarStarStarStar
Documentation:45%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:42%StarStarStar
Rank:2136