Refreshing only updated images using php.

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

    Refreshing only updated images using php.

    I am running a web page that has multiple web cams.
    The users are given ftp accounts to upload their web cam images every
    30 seconds.

    What I want to do is instead of having the "refresh" in the header to
    re-load the entire page from the server every 30 seconds, is to have
    it re-load only the images that have been updated in the last 30
    seconds. This is to cut down on wasted bandwidth.

    I was thinking of giving each webcam picture its own i-frame, and
    somehow getting the php to reload the frames containing the images
    that have recent file modifycation dates.

    Anyone have any ideas?
  • neur0maniak

    #2
    Re: Refreshing only updated images using php.

    Stokesy wrote:
    [color=blue]
    > I am running a web page that has multiple web cams.
    > The users are given ftp accounts to upload their web cam images every
    > 30 seconds.
    >
    > What I want to do is instead of having the "refresh" in the header to
    > re-load the entire page from the server every 30 seconds, is to have
    > it re-load only the images that have been updated in the last 30
    > seconds. This is to cut down on wasted bandwidth.
    >
    > I was thinking of giving each webcam picture its own i-frame, and
    > somehow getting the php to reload the frames containing the images
    > that have recent file modifycation dates.
    >
    > Anyone have any ideas?[/color]

    when you refresh the page, each image should have a querystring attached
    , with the unix time of when it was last updated. This means that
    browsers should cache the pictures that haven't changed and not bother
    to download them. But there's no predicting what people have what
    settings on their browser cache...

    Comment

    • Brian

      #3
      Re: Refreshing only updated images using php.

      Stokesy wrote:
      [color=blue]
      > I am running a web page that has multiple web cams. The users are
      > given ftp accounts to upload their web cam images every 30 seconds.
      >
      > What I want to do is instead of having the "refresh" in the header
      > to re-load the entire page from the server every 30 seconds,[/color]

      Not a robust solution, since the HTTP protocol does not have a
      "refresh" header.
      [color=blue]
      > is to have it re-load only the images that have been updated in the
      > last 30 seconds. This is to cut down on wasted bandwidth.[/color]

      Caching is the first thing you should be looking at. Is your server
      sending "Last-Modified" headers? Is it processing "If-Modified-Since"
      headers from the client?
      [color=blue]
      > I was thinking of giving each webcam picture its own i-frame,[/color]

      That sounds rather complicated.
      [color=blue]
      > and somehow getting the php to reload the frames containing the
      > images that have recent file modifycation dates.[/color]

      PHP is a scripting language; it can't add new features to HTTP. In any
      case, if each user changes one image from the page every 30 seconds,
      I'm not sure what you can gain from uploading the page one frame at a
      time.

      --
      Brian (remove ".invalid" to email me)

      Comment

      • Stokesy

        #4
        Re: Refreshing only updated images using php.

        neur0maniak <usenet@neur0ma niak.co.uk> wrote in message news:<40fa82b2$ 0$39766$ed2e19e 4@ptn-nntp-reader04.plus.n et>...[color=blue]
        > Stokesy wrote:
        >[color=green]
        > > I am running a web page that has multiple web cams.
        > > The users are given ftp accounts to upload their web cam images every
        > > 30 seconds.
        > >
        > > What I want to do is instead of having the "refresh" in the header to
        > > re-load the entire page from the server every 30 seconds, is to have
        > > it re-load only the images that have been updated in the last 30
        > > seconds. This is to cut down on wasted bandwidth.
        > >
        > > I was thinking of giving each webcam picture its own i-frame, and
        > > somehow getting the php to reload the frames containing the images
        > > that have recent file modifycation dates.
        > >
        > > Anyone have any ideas?[/color]
        >
        > when you refresh the page, each image should have a querystring attached
        > , with the unix time of when it was last updated. This means that
        > browsers should cache the pictures that haven't changed and not bother
        > to download them. But there's no predicting what people have what
        > settings on their browser cache...[/color]


        Its strange, if I make a form submit button that just points to
        itself, and i click that, only the updated images load, but if i put a
        refresh header in the html or php, when it reloads, it loads every
        picture off the server again regardless.

        Comment

        Working...