Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

gifs and keep alive

Options
  • 21-09-2010 11:39pm
    #1
    Registered Users Posts: 1,190 ✭✭✭


    I really appreciate any help people might give me on this. I'd also kindly ask people would just concentrate on the technical aspects and not why i'm doing this or what other ways i can do this instead such as javascript. i understand the bandwidth

    So the question is if someone opens up a gif for example, Can i make the server send the client frame by frame and also pause for long moments in between frames without the browser timing out the connection.

    If you want to shoot me over to another forum that's fine as well or point me towards more specific reading material i can find out by myself. I'd be aiming to do this in php but i'd be fine with doing a proof of concept by coding my own basic web server.


Comments

  • Closed Accounts Posts: 2,039 ✭✭✭rmacm


    Moved from Nets & Comms.


  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    If you're looking to animate predetermined frames you could use something like:
    Image Animation in JavaScript or Google for 'javascript image animation' for other options. This method preloads them.

    If you want them to dynamic load from the server look to Google the same keywords except using jQuery instead of plain old JavaScript.


  • Registered Users Posts: 1,190 ✭✭✭wolfric


    this is non predetermined and without javascript


  • Registered Users Posts: 1,228 ✭✭✭carveone


    There are methods to accomplish this used back before ajax and javascript generally became the norm. So I can't imagine any recent book talks about them but out of print books will.

    Divided into two categories:

    client pull: where the browser makes a new request every x seconds. ie: using meta http-equiv="refresh"...

    server push: connection is held open, data is sent periodically as multipart mime. Check out the multipart spec in (um... googling...ok):

    http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

    Also check out "MIME" in wikipedia.

    The server push method is likely what you are looking for. So the output from the server to the client would look something like:

    Content-type: multipart/x-mixed-replace;boundary=gc0p4Jq0M2Yt08jU534c0p
    --gc0p4Jq0M2Yt08jU534c0p
    Content-type: image/gif
    Image #1
    --gc0p4Jq0M2Yt08jU534c0p
    Content-type: image/gif
    Image #2
    --gc0p4Jq0M2Yt08jU534c0p
    Content-type: image/gif
    Image #3
    --gc0p4Jq0M2Yt08jU534c0p--

    The double -- means "we're done. have a nice day". The boundary is just some stuff that's unlikely to collide with our message data (yes, there are rules as to what can be in that boundary string).

    For those who have been around for ages, netscape mail used to use some rather bizarre things as the boundary. Like "StackfullsOfElephants" and other mad things....!


  • Registered Users Posts: 1,228 ✭✭✭carveone


    Oh yeah forgot to mention. You can hang about after each mime section is output. Some pseudo code:

    foreach (image in image_list)
    {
    open_and_output(image)
    print "\n--" . boundary_string . "\n"
    sleep (delay_time)
    }
    print "\n--" . boundary_string . "--\n"


  • Advertisement
Advertisement