PHP Classes
elePHPant
Icontem

Easy Image DB Management: Manage images stored in files or MySQL database

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2009-05-26 (7 years ago) RSS 2.0 feedNot enough user ratingsTotal: 749 All time: 4,289 This week: 902Up
Version License PHP version Categories
easyimagedb 1.3GNU General Publi...3Databases, Graphics
Description Author

This package can be used to manipulate images stored in files or in a MySQL database.

It can read images from files and store them in a MySQL database table, and vice-versa.

The main class can also convert images between GIF, JPEG and PNG formats, as well resize the images to create thumbnails.

Picture of Mikhail D
Name: Mikhail D <contact>
Classes: 1 package by
Country: Canada Canada

Details
Bit of explanation, mostly straight forward.

Errors:
1 No image in memory.
2 Duplicate exists.
3 Database registration fail.
4 Temp folder is not writable.
5 GD library could not create image.

Functions:
open(image_path)                               Open image from file. gif png or jpeg/jpg formats.
fetch(image_id)                                Fetch image data from mysql database. Must have $db loaded.
load()                                         Load the image data with GD library of PHP.
unload()                                       Unload image GD resource.
destroy()                                      Resets all class variables back to empty. Same as loading Image class a new.
save(filename, image_mime_type, permissions)   Save an opened image or if the GD loaded one to any of the gif jpeg or png formats.
convert(image_mime_type)                       Convert image bonary data between gif png and jpeg. Must be loaded with GD. Please set the temporary directory .
register()                                     Register the opened image data into mysql database.
show(image_mime_type)                          Displayed the opened image on screen. If it is loaded in GD, output(image_mime_type) will run instead, the mime type maybe added to overwrite original.
output(image_mime_type)                        Display the GD loaded image. Provide mime type to overwrite original.
getwidth()                                     Get width of the image loaded with GD.
getheight()                                    Get height of the image loaded with GD.
resizetoheight(height)                         Resize the GD loaded image proportionaly by height.
resizetowidth(width)                           Resize the GD loaded image proportionaly by width.
scale(scale%)                                  Scale the GD loaded image size by percent.
resize(width, height)                          Resize the GD loaded image to teh given size.


Examples:

  To simply display an image from mysql database and display:
    include('image.php');      (include both image and sql classes)
    include('sql.php');
    $image = new Image;        (initialize the image class)
    $image->db = new SQL;      (initialize mysql class to get connection and control functions inside image class)
    $image->fetch(82);         (we want image with teh id of 82 or any other)
    $image->show();            (display image on screen)

  To open an actual file and display:
    include('image.php');           (include the image class, dont need sql if we are not planing on using it)
    $image = new Image;             (initialize the image class)
    $image->open('phplogo.gif');    (open it up from file)
    $image->show();                 (display image on screen)

MySQL database table:


Tip: The mysql class is not necesery if you are not planning on using fetch() and register(), they are the only functions that need the sql class.
  Files folder image Files  
File Role Description
Accessible without login Plain text file image.php Class The main class.
Accessible without login Plain text file sql.php Class MySQL database management script used by the Image class if necesery, see reame file.
Plain text file sql_table_structure.txt Data MySQL simple table structure.
Accessible without login Plain text file readme.txt Doc. Some info on functions of the class.

 Version Control Unique User Downloads Download Rankings  
 0%
Total:749
This week:0
All time:4,289
This week:902Up