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 Mikhail D  >  Easy Image DB Management  >  readme.txt  >  Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Some info on functions of the class.
Class: Easy Image DB Management
Manage images stored in files or MySQL database
Author: By
Last change:
Date: 5 years ago
Size: 2,991 bytes
 

Contents

Class file image Download
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.