For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > December 2006 > picture sent in http with base64









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author picture sent in http with base64
Zbigniew Lisiecki

2006-12-03, 6:57 pm

Hi,
to provide visual confirmation for
http://beztajemnic.evot.org/index.php?s=1
my server is sending data:image/png;base64 in the http protocoll.
This allows to omit writting picture data on the disk,
actually this part of the disk is read only.

With my KDE/konqueror and Firefox under Linux I can see the
correct picture, but some clients don't see it.
How could I correct this error ?

thank you in advance
Zbyszek
--
http://zbyszek.evot.org
Ric

2006-12-03, 6:57 pm

Zbigniew Lisiecki schrieb:
> Hi,
> to provide visual confirmation for
> http://beztajemnic.evot.org/index.php?s=1
> my server is sending data:image/png;base64 in the http protocoll.
> This allows to omit writting picture data on the disk,
> actually this part of the disk is read only.
>
> With my KDE/konqueror and Firefox under Linux I can see the
> correct picture, but some clients don't see it.
> How could I correct this error ?
>
> thank you in advance
> Zbyszek


First I would try to make sure the html is correct:-)

<img src="data:image/png;.... name="vconf.png"

is missing: ", after adding it I see "smover" :-)
Zbigniew Lisiecki

2006-12-03, 6:57 pm

Ric wrote:

> Zbigniew Lisiecki schrieb:
>
> First I would try to make sure the html is correct:-)
>
> <img src="data:image/png;.... name="vconf.png"
>
> is missing: ", after adding it I see "smover" :-)


Yes Ric,
is my html correct now ?
z
--
http://zbyszek.evot.org
Ric

2006-12-03, 6:57 pm

Zbigniew Lisiecki schrieb:
> Ric wrote:
>
>
> Yes Ric,
> is my html correct now ?
> z


Well the image is there now, but you still got some errors:-)


If I open Firefoxs Error-Console I can see two messages, complaining
about a unknown property: boder-top
Should be: border-top
Zbigniew Lisiecki

2006-12-03, 6:57 pm

Ric wrote:

> Zbigniew Lisiecki schrieb:
>
> Well the image is there now, but you still got some errors:-)
>
>
> If I open Firefoxs Error-Console I can see two messages, complaining
> about a unknown property: boder-top
> Should be: border-top


yes, I'v corrected this.
I am happy the picture is there.
Do you think it can be seen in all browsers now ?
z
--
http://zbyszek.evot.org
Michael Fesser

2006-12-03, 6:57 pm

..oO(Zbigniew Lisiecki)

>to provide visual confirmation for
>http://beztajemnic.evot.org/index.php?s=1
>my server is sending data:image/png;base64 in the http protocoll.
>This allows to omit writting picture data on the disk,
>actually this part of the disk is read only.
>
>With my KDE/konqueror and Firefox under Linux I can see the
>correct picture, but some clients don't see it.
>How could I correct this error ?


IE doesn't support data URLs.

Micha
Zbigniew Lisiecki

2006-12-03, 9:57 pm

Michael Fesser wrote:

> .oO(Zbigniew Lisiecki)
>
>
> IE doesn't support data URLs.


It means you don't see the picture, do you ?
What is the correct solution on the read-only server fs then ?
z
--
http://zbyszek.evot.org
Zbigniew Lisiecki

2006-12-03, 9:57 pm

Michael Fesser wrote:

> .oO(Zbigniew Lisiecki)
>
>
> IE doesn't support data URLs.


It means you don't see the picture, do you ?
What is the correct solution on the read-only server fs then ?

The way i do now is:

function gen_rand_img () {
...
ob_start (NULL, 4096);
imagepng($img);
imagedestroy($img);
return (base64_encode(ob_get_clean()));
}

$head="
<!doctype html public \"-//w3c//dtd html 4.0 transitional//EN\">
<html>
<head>
<title>...</title>
<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=iso-8859-2\"
....";

echo $head;

header("Cache-Control: no-store, no-cache, must-revalidate"); //http/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0

....

echo "
echo "<img src=\"data:image/png;base64,".gen_rand_img()."\"
name=\"vconf.png\">";


z
--
http://zbyszek.evot.org
Zbigniew Lisiecki

2006-12-03, 9:57 pm

Michael Fesser wrote:

> .oO(Zbigniew Lisiecki)
>
>
> IE doesn't support data URLs.


It means you don't see the picture, do you ?
What is the correct solution on the read-only server fs then ?

The way i do it now is:

function gen_rand_img () {
...
ob_start (NULL, 4096);
imagepng($img);
imagedestroy($img);
return (base64_encode(ob_get_clean()));
}

$head="
<!doctype html public \"-//w3c//dtd html 4.0 transitional//EN\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html;
charset=iso-8859-2\"
....";

echo $head;

header("Cache-Control: no-store, no-cache, must-revalidate"); //http/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0

....

echo "<img src=\"data:image/png;base64,".gen_rand_img()."\"
name=\"vconf.png\">";


z
--
http://zbyszek.evot.org
Zbigniew Lisiecki

2006-12-04, 3:57 am

Zbigniew Lisiecki wrote:

> It means you don't see the picture, do you ?


sorry,
I corrected this for MSIE allowing to write png image to the filesystem.
To test the original problem now you have to change your brower
identification.

Now I hope everybody can see the picture.
z
--
http://zbyszek.evot.org
Michael Fesser

2006-12-04, 6:57 pm

..oO(Zbigniew Lisiecki)

>Zbigniew Lisiecki wrote:
>
>I corrected this for MSIE allowing to write png image to the filesystem.
>To test the original problem now you have to change your brower
>identification.
>
>Now I hope everybody can see the picture.


Looks OK. Opera and Firefox get the "embedded" image, while IE shows the
PNG. But why don't you just drop the data URL and use the PNG for all
browsers? This is more reliable and would avoid browser sniffing.

Micha
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com