Csaba Gabor wrote:[color=blue]
> Ultimately, I can solve this problem by pointing the image's src to
> "http://webAppDomain.com/webApp.php?getImage=folder" and have
> webApp.php spit out the image in this case, but a simpler, more
> straightforward solution would be preferred.[/color]
This question was a technology question, and not specific to any
particular one. Therefore, even though I don't have a client side
solution I'm happy with, in the absence of other replies, and in the
interest of at least one solution, I detail what works for me, though
it is PHP and not javascript. At the top of the webApp.php file I
have:
<?php
if ($_REQUEST && $imgName = $_REQUEST['sendImage'])
sendImage($imgName);
function sendImage($imgName) {
header("Content-type: image/gif");
$gif = "GIF89a\x0F\x00\x0D\x00\xA2\xFF\x00\xC0\xC0\xC 0" .
"\xFF\xFF\x00\xC0\xC0\xC0\x80\x80" .
"\x80\x00\x00\x00\x00\x00\x00\x00" .
"\x00\x00\x00\x00\x00\x21\xF9\x04" .
"\x01\x00\x00\x00\x00\x2C\x00\x00" .
"\x00\x00\x0F\x00\x0D\x00\x40\x03" .
"\x33\x08\x30\xCC\xFA\x6F\x80\x20" .
"\xA8\xAD\x75\x10\x79\x7B\x26\x00" .
"\x21\x8E\x24\x39\x60\x57\xD3\x2C" .
"\x13\xEA\x06\x1A\xF7\xA2\xDA\xE2" .
"\x4A\x90\x82\xE7\x79\x0C\xCC\xA9" .
"\xCD\xCF\x13\x94\x00\x31\x31\x95" .
"\x52\x45\x48\x00\x00\x3B";
$size = strlen($gif);
header("Content-Length: $size bytes");
print ($gif);
exit();
}
?>
One would call this like
<img src='http://webAppDomain/webApp.php?sendImage=folder'> Now it
might be that because the src is always the same, the image will be
cached and the server won't be hit again for subsequent requests. But
I forget whether or not that .php will cause the browser to ignore the
cache. If so, then what could be done is to replace that
webApp.php?sendImage=folder with folder.gif and have your Apache web
browser rewrite the folder.gif request to webApp.php?sendImage=folder.
Of course that steps outside the bounds of the original problem since
apache's httpd.conf file would be getting modified. Some further
comments on this approach to cacheing may be found at
http://php.net/imagecreatefrompng
Csaba Gabor from Vienna