You are here: Re: Confusion re blobs and images « All PHP « IT news, forums, messages
Re: Confusion re blobs and images

Posted by J.O. Aho on 12/24/06 09:43

kenoli wrote:
> I want to store thumbnail images in a table with person data and then
> retreive the image data and dislay it on a web page along with other
> data about the person. All of the examples showing how to retrieve
> image data from a blob field seem to assume that it will be displayed
> on a separate page sending a header like this:
>
> Header( "Content-type: $type");
> echo $data;

To make it easy, we assume this script (what you call page) is called view.php


> I'd like to retrieve the data and display it on a page in the middle of
> other information like I would an image file stored in a directory,
> e.g.
>
> <img src=[data from the blob field]>

With the previous assumption
<img src="view.php?id=<?php echo $imageid; ?>" title="my dynamig image"
alt="missing image">


> I don't really understand the Header . . . echo construction. I have
> just seen examples of this but no explanations about is how this works.

header is used to describe the contents of the data that is sent and is
specially useful when you send image data instead of html.

http://www.php.net/manual/en/function.header.php



> I thought about perhaps retrieving the data from the blob and then
> writing it to a file and then displaying the file using <img> but
> couldn't figure out how to do that aside from thinking it may use
> file_put_contents() somehow, though I couldn't figure out exactly how
> to do it.

Thats possible to do, specially on a low traffic site, but with increasing
traffic you will just get high slowdowns and even risk of wrong images displayed.


--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация