PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Richard Carson   PHP MySQL Image Display   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP MySQL Image Display
Serve images added to a MySQL database table
Author: By
Last change:
Date: 9 years ago
Size: 1,366 bytes
 

Contents

Class file image Download

SQLimg

Facilitates the storage and delivery of small images via MySQL. This method is far faster than traditional methods, and potentially less error-prone when uploading images often.

Method summary:

all($con=false) List all images in the database

$con: An optional database connection (optimization)
returns an associative array of keys and types

exists($key, $con=false) Determine weather or not a given image exists

$key: The image's unique key
$con: An optional database connection (optimization)
returns boolean

display($key) Display a stored image - CALL BEFORE HEADERS ARE SENT

$key: The image's unique key

upload($file, $key=null) Store an image through upload - uses the $_FILES superglobal

$file: The URL key to search for a file
$key: An image to replace (optional)
returns false if the image could not be uploaded, the new unique key otherwise

remove($key) Remove a stored image

$key: The image's unique key
returns false if the image did not exist, true otherwise

add($data, $type) Store a new image

$data: the image's binary
$type: the image's format
returns the image's unique key, or false on failure

replace($key, $data, $type) Replace an existing image

$key: The image's unique key
$data: the image's binary
$type: the image's format
returns false on failure, true otherwise