472,114 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

Replace old image: question


Can someone please help me with this problem? I don't know if this is
possible in Java, so if it's not please point me in the right direction
or to the right newsgroup! (I'm a newby to Java scripting).

On a web page I have a webcam type image that updates every minute. I
wish to conditionally replace this image with an apology image in the
event that my upload fails for more than an hour. I guess what I want is
some script that will check the image file timestamp (last modified
time), and if it's more than an hour old replace it with the apology
image. I've scoured the web for ideas but so far found nothing. Can
anyone write the script for me? I'd be very grateful!

Thankyou in anticipation,
Andy.
--

Jul 23 '05 #1
3 1639
"Andy" <an**@not.telling.you> wrote in message
news:AM**************@i.am.not.telling.you...

Can someone please help me with this problem? I don't know if this is
possible in Java, so if it's not please point me in the right direction
or to the right newsgroup! (I'm a newby to Java scripting).

On a web page I have a webcam type image that updates every minute. I
wish to conditionally replace this image with an apology image in the
event that my upload fails for more than an hour. I guess what I want is
some script that will check the image file timestamp (last modified
time), and if it's more than an hour old replace it with the apology
image. I've scoured the web for ideas but so far found nothing. Can
anyone write the script for me? I'd be very grateful!


Just a tip (since you say you're a newbie...):

You use the word "Java" and "Java scripting" (two words).

You *are* aware of the fact that Java and JavaScript is two
completely different languages that have nothing to do with
each other?

Java is a fullblown OO programming language developed by Sun,
and JavaScript originated at Netscape, and is now an (extended)
implementation of ECMAScript.

Just thought I mention it, as it can severely mislead your
searches for information...

As to your question, That would best be done on the server,
and not in script in the clients browser.

--
Dag
58°26'15.9" N 008°46'45.5" E
Jul 23 '05 #2
Good point about the differences between Java and Javascript, though I
disagree that it would be best done on the server. Depending on what is
needed, that would mean another (messy) page reload.

Most sites with pictures seem to dynamically replace images nowadays
without a page reload.


Dag Sunde wrote:
"Andy" <an**@not.telling.you> wrote in message
news:AM**************@i.am.not.telling.you...
Can someone please help me with this problem? I don't know if this is
possible in Java, so if it's not please point me in the right direction
or to the right newsgroup! (I'm a newby to Java scripting).

On a web page I have a webcam type image that updates every minute. I
wish to conditionally replace this image with an apology image in the
event that my upload fails for more than an hour. I guess what I want is
some script that will check the image file timestamp (last modified
time), and if it's more than an hour old replace it with the apology
image. I've scoured the web for ideas but so far found nothing. Can
anyone write the script for me? I'd be very grateful!

Just a tip (since you say you're a newbie...):

You use the word "Java" and "Java scripting" (two words).

You *are* aware of the fact that Java and JavaScript is two
completely different languages that have nothing to do with
each other?

Java is a fullblown OO programming language developed by Sun,
and JavaScript originated at Netscape, and is now an (extended)
implementation of ECMAScript.

Just thought I mention it, as it can severely mislead your
searches for information...

As to your question, That would best be done on the server,
and not in script in the clients browser.


Jul 23 '05 #3
On Mon, 05 Jul 2004 18:24:25 GMT, Joe Bloggs wrote:
Dag Sunde wrote:
"Andy" <an**@not.telling.you> wrote in message
...please do not top-post Andy, it is most confusing..
<http://www.physci.org/codes/javafaq.jsp#netiquette>
see further comment below.
On a web page I have a webcam type image that updates every minute. I
wish to conditionally replace this image with an apology image in the
event that my upload fails for more than an hour. .......I guess what I want is
some script that will check the image file timestamp (last modified
time), and if it's more than an hour old replace it with the apology
image. I've scoured the web for ideas but so far found nothing. Can
anyone write the script for me? I'd be very grateful!
... As to your question, That would best be done on the server,
and not in script in the clients browser.

How do your users get fresh images?
If the page regularly refreshes itself then
Dag's suggestion is probably the best.
Simply swap the image name of "web-cam.jpg"
or "apology.jpg" to the "current-image.jpg"
that the web page requests and your users
will see whatever image is appropriate.
I disagree that it would be best done on the server. Depending on what is
needed, that would mean another (messy) page reload.

Most sites with pictures seem to dynamically replace images nowadays
without a page reload.


It is possible to dynamically swap images,
but if your page is getting fresh web-cam
pics it is already reloading some data.

This all becomes a lot more clear if we
can see your page. What's the URL?

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Jake | last post: by
4 posts views Thread by Nel | last post: by
12 posts views Thread by Charlie King | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.