servlet how to show "loading image"

R

Rob

I have a servlet that loads images, which are usually big. I want
to show the message "loading image" when retrieving the image,
and automatically shows the image once it is done. Any suggestions
here?
 
A

Andrew Thompson

Rob said:
I have a servlet that loads images, which are usually big. I want
to show the message "loading image" when retrieving the image,

If you put a thin but obvious border around the space the image
will occupy, images (at least JPGs and GIFs) are pretty efficient
at showing their own 'load progress'. And they will demonstrate
the progress with something much more interesting than an
'hourglass'.
..and automatically shows the image once it is done. Any suggestions
here?

KISS.

--
Andrew Thompson
http://www.physci.org/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200712/1
 
R

Rob

If you put a thin but obvious border around the space the image
will occupy, images (at least JPGs and GIFs) are pretty efficient
at showing their own 'load progress'. And they will demonstrate
the progress with something much more interesting than an
'hourglass'.


KISS.

Andrew, I'm not quite sure I understand you clearly.
What I want to show is dynamic loading image like http://www.ajaxload.info/
and automatically switches to the image once it has been loaded.
 
A

Andrew Thompson

Rob wrote:
...
Andrew, I'm not quite sure I understand you clearly.

I am also relatively confident that is the case. My
take is that you are over-thinking this, and as a result,
are about to make (yet) a(nother) crappy web. app.
What I want to show is dynamic loading image like http://www.ajaxload.info/
and automatically switches to the image once it has been loaded.

Ughh. Now that is pointless and stupid. Instead of
an image that is scanning down the page line by line
as it is loading*, I get to watch a sickening little 'twirly
thing' that shows no indication of the % progress?
One step forward, two steps back.

* I am thinking JPEG there, as opposed to GIFs,
which have a much smarter way to show 'some part'
of the image early on.

BTW -
What format are the images?
How big are the images (in px and bytes)?

--
Andrew Thompson
http://www.physci.org/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200712/1
 
R

Rob

Rob wrote:

..


I am also relatively confident that is the case. My
take is that you are over-thinking this, and as a result,
are about to make (yet) a(nother) crappy web. app.


Ughh. Now that is pointless and stupid. Instead of
an image that is scanning down the page line by line
as it is loading*, I get to watch a sickening little 'twirly
thing' that shows no indication of the % progress?
One step forward, two steps back.

* I am thinking JPEG there, as opposed to GIFs,
which have a much smarter way to show 'some part'
of the image early on.

BTW -
What format are the images?
How big are the images (in px and bytes)?

The images are dynamically generated, in PNG format. Size varies.
I'm thinking of going AJAX for that purpose. But not sure how
to, any hint?
 
A

Andrew Thompson

Rob wrote:
...
The images are dynamically generated, in PNG format.

Smack 'em out to JPEG. That should reduce the size to
at least a third.
..Size varies.

How *much?* What is the frigging *minimum* and *maximum*?
(Sheesh) Getting information from some people is like
pulling teeth, from a chook.
I'm thinking of going AJAX for that purpose. But not sure how
to, any hint?

Don't.
 
L

Lew

Andrew said:
Rob wrote:
...

Smack 'em out to JPEG. That should reduce the size to
at least a third.


How *much?* What is the frigging *minimum* and *maximum*?
(Sheesh) Getting information from some people is like
pulling teeth, from a chook.


Don't.

There's a standard idiom for showing images in web apps - have a servlet
serve'em up. Then Andrew's placeholder trick can work.

<img src="/Imager?name=foo.jpg" />

I use this for, say, when images are stored in a database instead of a
relative directory of the web app. Also useful for images created on the fly.
 
R

Roger Lindsjö

Lew said:
There's a standard idiom for showing images in web apps - have a servlet
serve'em up. Then Andrew's placeholder trick can work.

<img src="/Imager?name=foo.jpg" />

I use this for, say, when images are stored in a database instead of a
relative directory of the web app. Also useful for images created on
the fly.

Or map Imager/* to your servlet so you can write <img
src="Imager/foo.jpg"> if you want all browsers to understand that the
image name is foo.jpg (should the user try to save the image). This
specially applies to SonyEricsson mobiles if I remember correctly.

//Roger Lindsjö
 
R

RedGrittyBrick

Andrew said:
Rob wrote:
..

Smack 'em out to JPEG. That should reduce the size to
at least a third.

IME that depends entirely on the image content. For images with
continuously varying tone and high levels of detail, JPEG will give
better compression (assuming you use lossy compression, as you know, you
can set JPEG quality to 100% for effectively lossless compression).

In other cases PNG can give better compression than JPEG.

To achieve high compression with JPEG involves a tradeoff in quality
which can lead to very noticable muddiness and ringing effects on images
with flat-colour backgrounds.

I'd try both.
 
A

Andrew Thompson

RedGrittyBrick said:
IME that depends entirely on the image content.

True - good point. Technical drawings or blueprints
can become blurry when the compression is high, and
JPEG is pretty pointless when compression is low.
But for these particular (line based) drawings, I would
even recommend...
...For images with
continuously varying tone and high levels of detail, JPEG will give
better compression (assuming you use lossy compression, as you know, you
can set JPEG quality to 100% for effectively lossless compression).

In other cases PNG can give better compression than JPEG.

To achieve high compression with JPEG involves a tradeoff in quality
which can lead to very noticable muddiness and ringing effects on images
with flat-colour backgrounds.

I'd try both.

.. trying dropping the colors to 256 and perhaps even
rendering it as a (shock horror) GIF (or PNG*). Dropping
the number of colors can result in a significant reduction in
image byte size.

* Huhh. That is neat.

--
Andrew Thompson
http://www.physci.org/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200712/1
 
L

Lew

Roger said:
Or map Imager/* to your servlet so you can write <img
src="Imager/foo.jpg"> if you want all browsers to understand that the
image name is foo.jpg (should the user try to save the image). This
specially applies to SonyEricsson mobiles if I remember correctly.

Nice tip. I can make immediate use of that - in fact, for a client's project.

This newsgroup helps us earn a living.
 
R

Roger Lindsjö

Lew said:
Nice tip. I can make immediate use of that - in fact, for a client's
project.

This newsgroup helps us earn a living.

Glad to be of help, that's one of the main reasons I come here, almost
every day I learn something new.

//Roger Lindsjö
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top