Replace old image: question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    #1

    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.
    --

  • Dag Sunde

    #2
    Re: Replace old image: question

    "Andy" <andy@not.telli ng.you> wrote in message
    news:AMHfKqOuw1 xAFwiJ@i.am.not .telling.you...[color=blue]
    >
    > 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!
    >[/color]

    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


    Comment

    • Joe Bloggs

      #3
      Re: Replace old image: question

      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:
      [color=blue]
      > "Andy" <andy@not.telli ng.you> wrote in message
      > news:AMHfKqOuw1 xAFwiJ@i.am.not .telling.you...
      >[color=green]
      >>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!
      >>[/color]
      >
      >
      > 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.
      >[/color]

      Comment

      • Andrew Thompson

        #4
        Re: Replace old image: question

        On Mon, 05 Jul 2004 18:24:25 GMT, Joe Bloggs wrote:[color=blue]
        > Dag Sunde wrote:[color=green]
        >> "Andy" <andy@not.telli ng.you> wrote in message[/color][/color]

        ...please do not top-post Andy, it is most confusing..
        <http://www.physci.org/codes/javafaq.jsp#net iquette>
        see further comment below.
        [color=blue][color=green][color=darkred]
        >>>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.[/color][/color][/color]
        ....[color=blue][color=green][color=darkred]
        >>>...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![/color][/color][/color]
        ...[color=blue][color=green]
        >> As to your question, That would best be done on the server,
        >> and not in script in the clients browser.[/color][/color]

        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.jp g" to the "current-image.jpg"
        that the web page requests and your users
        will see whatever image is appropriate.
        [color=blue]
        > 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.[/color]

        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

        Comment

        Working...