PDA

View Full Version : Rendering images coming from Database - MYSQL



giovani
13 Aug 2009, 6:40 AM
Hello, is there a way that I can render a image on the browser (let's say in a grid component), that is coming
directly from the database - it is NOT on the file system, the image is being stored on the database only.

The back-end that we use is PHP.

I would like to avoid having duplicated images, file system and database. That is the reason of my question.

Worse case scenario I believe that I would have to some how save the image to the file system via PHP and then
use EXTJs to render it on the screen loading the images from the file system.

pdegit
13 Aug 2009, 6:46 AM
Performance-wise I'm not sure about storing your images 'database-only', but that's not your question... I think what you want is the <OBJECT> tag pointing to the php script returning the image.

MiamiCoder
14 Aug 2009, 11:44 AM
You can point the src of the image to the php script that streams the image. Something like <img src="image-generator.php?id=img1" alt="img1" />