Reply to Re: Displaying pictures

Your name:

Reply:


Posted by Jim Michaels on 01/15/06 09:35

where do I go to find out how to manipulate the cache with headers?

"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:1137286681.506700.37070@g43g2000cwa.googlegroups.com...
> gooze wrote:
>> Hello
>>
>> I am working on an applicaion that shows several pictures on a webpage.
>> These pictures are saved in a MySQL DB as BLOB. I noticed, that the web
>> server suffers in its performance by printing the pictures. Let's say
>> there are 20 pictures to show, there also are 20 queries to do. This is
>> the way I am doing it up to now:
>>
>> index.php
>> <?php
>> foreach ($icons as $value) {
>> echo '<img src="./show_icon.php?icon_id=' . $value . '">';
>> }
>> ?>
>>
>> show_icon.php
>> <?php
>> $query = "SELECT icon FROM pictures WHERE id='$_GET['icon_id'] ";
>> $result = @mysql_query ($query) or die (mysql_error());
>> $icon = @mysql_result ($result, 0, "icon");
>>
>> header("Content-type: image/png");
>> echo $icon;
>> ?>
>>
>> Actually this works quite well, but the performance is an issue. Is
>> there a more simple or more elegant way than the code above? Is there
>> actually a solution to do it with one query instead of 20 queries?
>>
>> Thanks for your help
>> Stefan
>
> The performance issue you're experiencing is unlikely to be caused by
> the overhead of storing images in the database. The bottleneck is
> usually the Internet. Even a slow server can retrieve data from the
> database faster than can be transferred across the network.
>
> There are a couple things that could slow things down. First, make sure
> the images are cached on the client-side by sending the appropriate
> HTTP headers. Second, check to see if session-auto-start is turn on. If
> it is, then call session_write_close() before sending the image data.
>

[Back to original 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

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