Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

servlet how to show "loading image"

Thread view: 
Rob - 13 Dec 2007 16:51 GMT
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?
Andrew Thompson - 13 Dec 2007 17:13 GMT
>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.

Signature

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

Rob - 13 Dec 2007 18:35 GMT
> >I have a servlet that loads images, which are usually big. I want
> >to show the message "loading image" when retrieving the image,
[quoted text clipped - 14 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200712/1

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.
Andrew Thompson - 13 Dec 2007 20:00 GMT
...
>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)?

Signature

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

Rob - 13 Dec 2007 20:10 GMT
> ..
>
[quoted text clipped - 25 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200712/1

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?
Andrew Thompson - 13 Dec 2007 20:17 GMT
...
>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.

Signature

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

Lew - 14 Dec 2007 02:15 GMT
> ...
>> The images are dynamically generated, in PNG format.
[quoted text clipped - 12 lines]
>
> 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.

Signature

Lew

Roger Lindsjö - 14 Dec 2007 07:16 GMT
>> ...
>>> The images are dynamically generated, in PNG format.
[quoted text clipped - 20 lines]
> 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ö
Lew - 14 Dec 2007 13:49 GMT
> 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.

Signature

Lew

Roger Lindsjö - 14 Dec 2007 22:20 GMT
>> Or map Imager/* to your servlet so you can write <img
>> src="Imager/foo.jpg"> if you want all browsers to understand that the
[quoted text clipped - 5 lines]
>
> 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ö
RedGrittyBrick - 14 Dec 2007 11:22 GMT
> ..
>> The images are dynamically generated, in PNG format.
>
> 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.
Andrew Thompson - 14 Dec 2007 12:28 GMT
>> ..
>>> The images are dynamically generated, in PNG format.
[quoted text clipped - 3 lines]
>
>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
[quoted text clipped - 8 lines]
>
>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.

> ..<http://www.libpng.org/pub/png/book/chapter01.html#png.ch01.div.2.3>

* Huhh.  That is neat.

Signature

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

RedGrittyBrick - 14 Dec 2007 11:16 GMT
>>> What I want to show is dynamic loading image likehttp://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
[quoted text clipped - 3 lines]
>> 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?

Have you tried generating *interlaced/progressive* PNG?
http://www.libpng.org/pub/png/book/chapter01.html#png.ch01.div.2.3


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.