PHP MySQL example: image gallery (blob-storage) – Source anyexample.com

Posted by Jiltin     22 February, 2009    922 views   

I wanted to store an image in mysql tables. Just googled, and got a working example from anyexample.com. A minor change is required for the script. Instead of

echo "<a href=’{$PHP_SELF}?show={$id}’>{$title}</a> &ndash; ";

it should be

echo "<a href=" . $PHP_SELF . "?show={$id}’>{$title}</a> &ndash; ";

Here is the script details reproduced from original page:
This is a simple example of photo-gallery script, which uses MySQL table (BLOB field) to store images. Trivial password-protection, uploading and deleting images are supported. For Apache-version of PHP there is advanced browser-caching support (using If-Modified-Since header).

compatible
* PHP 4.3.0 or higher
* PHP 5
There are three notable parts of the script:
* main page generation –
generates HTML code for the list of uploaded photos, forms for photo deletion and uploading

* image uploading –
processes POST request: checks password, uploads photo to database or deletes it

* image showing –
Fetches image information from MySQL database and sends image do browser. If PHP is installed as mod_php (for Apache), does If-Modified-Since HTTP header checking.

Here is the working example http://www.notesbit.com/download/test/blob/ae_gallery.php. Of course password is different, as I do not want to get my server crashed!!

Following Google Searches Lead To This Post: PHP MySQL image gallery (blob-storage)

Post to Twitter  Post to Delicious  Post to Digg    Post to StumbleUpon

Categories : MySQL, Web & Scripts Tags : , ,

Comments

No comments yet.


Leave a comment

(required)

(required)