Re: image thumbnail from blob data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2010-06-07 at 02:37 +0600, saeed ahmed wrote:

> hello friends,
> 
> image store into database in a blob field, But when I'm trying to retrieve
> it from the database then its cause problems.
> 
> if I'm trying header( "Content-type: image/jpeg") (if my image type is
> jpeg), then its working well. but when I'm trying to mixing up this with
> some HTML code then its not working. Ok I understand its not working because
> the header already sent by the browser.
> 
> now suggest me what should I use there to retrieve the image from database?
> I have to mix the HTML code in my script. So is their any other way to do
> this without header?
> 
> saeed ahmed
> http://saeed05.wordpress.com


Have one script that just fetches the image and sets the header for
that, and then fetch the content. I am assuming that you are storing the
images separate from the HTML in this case anyway? The only way to have
the image data inline with the HTML that I know of is to base64 encode
the image data, but that won't work on Internet Explorer (other decent
browsers work fine though)

Having said that, it's not generally a good idea to store images as
blobs in my experience. It can create slowdowns in database access, and
increases the amount of space the db requires by a lot! What most people
do I've found is to store the image as a file and store the path and
filename to it in the db. However, if the location is going to change
often then it might be best to store it as a blob like you're doing.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux