Re: Images retrives [message #175972 is a reply to message #175971] |
Fri, 11 November 2011 23:49 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Robert Hairgrove wrote:
> Thomas 'PointedEars' Lahn wrote:
>> sritullimilli(at)gmail(dot)com wrote:
>>> i didn't get the images from mysql database through php script
>>> i am get this error
>>>
>>> <img src='���JFIF
>>
>> […]
>> C)
>>
>> <?php
>> $img_data = db_query(…);
>> if ($img_data)
>> {
>> ?>
>> <img src="data:image/jpeg;base64,<?php
>> echo base64_encode($imgdata); // [5]
>> ?>"
>> alt="…" …>
>> <?php
>> }
>> ?>
>>
>> A) and B) are more compatible than C) [6].
>> […]
>> C) requires fewer server filesystem resources than A) but it might not be
>> cacheable and it requires more computational effort on the server and
>> client-side instead. It is limited by the maximum URI length accepted by
>> a Web browser (2083 characters by Internet Explorer up to and including
>> version 9.x, at the time of writing [7]); in particular, base64 encoding
>> makes the encoded string about one third longer than the original. (By
>> contrast, URI percent-encoding can make the encoded string three times as
>> long as the original.)
>>
>> Use A) or B) unless there is a compelling reason to use C).
>>
>> I also recommend not to store image data or other BLOBs in the database
>> unless there is a compelling reason to do otherwise. Store the filename
>> in the database instead, and store the image data as a file in the
>> filesystem; that way, it is also easier to implement A).
>> […]
>> [5]<http://php.net/base64_encode>
>> [6]<http://en.wikipedia.org/wiki/Data_URI_scheme>
>> [7]<http://support.microsoft.com/kb/208427/en-us>
>
> There are times when it is necessary to use something like C) ... for
> example, to display on-the-fly generated captcha images.
That is appropriate if you do not have to support IE 7 [^6]. Unfortunately,
we have to.
Please trim your quotes to the relevant minimum next time, and use a proper
`From' header field value.
<http://www.netmeister.org/news/learn2quote.html>
<http://www.interhack.net/pubs/munging-harmful/>
As I suspect you might understand German, you should consider these:
[de] <http://www.afaik.de/usenet/faq/zitieren/>
[de] <http://www.gerlo.de/falsche-email-adressen.html>
PointedEars
--
When all you know is jQuery, every problem looks $(olvable).
|
|
|