Re: image thumbnail from blob data
| From: | Ashley Sheridan | Date: | Sun, 06 Jun 2010 20:55:20 +0000 |
| Subject: | Re: image thumbnail from blob data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-305862@lists.php.net to get a copy of this message | ||
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