An easy way to accomplish this is to make a php file which sets the
headers and such...
Then you call the php file with an image id or whatever and it returns
the image you want....
Example:
Image = new Image("www.somepage.com/image.php?id=42");
I'm sure there's lots of examples out there on how to make the php
file - it's easy though... In my project I've done it with files in
general - looks like this:
<?php
if (isset($_REQUEST['file_id'])) {
$file = new File($con, $_REQUEST['file_id']);
header("Cache-Control: public, must-revalidate");
header("Pragma: hack");
header("Expires: 0");
header("Content-Type: " . $file->getMime());
header("Content-Length: " . $file->getSize());
header("Content-Disposition: attachment; filename=\"" . $file-
>getName()."\"");
header("Content-Transfer-Encoding: binary");
echo $file->getBlob();
exit;
}
echo "File not found!";
?>
As you can see I use a homebrew File class to contain the database
information, but that's not needed.
BE AWARE that IE relies heavily on the order of the headers, so use
the order I've used, and all will be fine :)
On Jun 7, 9:58 am, George Georgovassilis <g.georgovassi...@gmail.com>
wrote:
> While this has nothing to do with GWT, here is a link [1] to an
> example of a servlet that can stream images from a file - the file is
> the byte[] source and it's then written to the request. You'd probably
> only change the source, that is get the byte[] from querying a
> database.
> [1]http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q...
> On Jun 7, 8:01 am, "Sunita Mittal" <sunita.mit...@daffodildb.com>
> wrote:
> > Hello,
> > Currently the way we can make image is using the url and loading the
> > image from defined url.
> > But suppose , if I have a image stored in database and want to send the
> > byte[] to client and show the image by making a temp file at client side.
> > How it can be achived.
> > Or any other way We can manage showing image stored in database (i.e.
> > binary or BLOB data).
> > Thanks
> > Sunita Mittal.- Hide quoted text -
> - Show quoted text -