[ic] Serving the images from a database

Mike Heins mike at perusion.com
Wed May 5 11:37:19 EDT 2004


Quoting Lars Segerlund (konsult at sebab.se):
> 
> Has anyone served the images for interchange through the database ?

I have.

> 
> I am thinking of putting a lot of images as BLOB's in an MySql database 
> and perhaps caching them as files on the webserver/interchange server.

It works, but Interchange is not the fastest method for serving files.

You could pretty easily make IC the 404 handler for images if you use
Apache, and have it pull the image out and place it on the file system
when requested.

If you make "AcceptRedirect Yes" in interchange.cfg, IC will take
Apache's redirects when you make it the handler for 404. You could
intercept the request in Autoload, and:

    * determine whether the request asks for an image/* MIME type
    * pull the image out of the database and write it to disk
    * deliver it with $Tag->deliver()

Apache makes it relatively easy as I believe you get a PATH_TRANSLATED
variable that tells you where the file should have been.

> 
> I just wanted to know if this is done or there are any complications, I 
> am fairly new to interchange so I'd rather ask before starting to 
> implement, sorry for waisting the bandwidht.

No, that is an interesting application. It would certainly make it
easier to transport a catalog, as finding the image path and 
copying the images is one of the hardest part of moving the
catalog around.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.765.647.1295  tollfree 800-949-1889 <mike at perusion.com>

If you think nobody cares if you're alive, try missing a couple of
car payments.  -- Earl Wilson


More information about the interchange-users mailing list