Another method you can try is to grab not the image, but a "proxy" that will send the MIME header for the image then stream the file. This technique is used when images are stored in a database, or where people want to keep downloadable files outside of the web root to secure them from unauthorized download. You would have something like: <img src="serveImage.php?id=xxxxx">.
You could then just have a timer to update the SRC of the target image tag. This doesn't even require an Ajax call. On Aug 28, 5:28 pm, S <[EMAIL PROTECTED]> wrote: > I will use Ajax.Request as my last resort later. Right now I'm still > trying to use Ajax.PeriodicalUpdater to update the image from server > every second. I need to update a status page that contains many text > and images. Most of them need to be updated every second. I have > existing codes that convert all data to an image file which can be > loaded on web browser. > > The image is updated every second on the server. But, on the web > browser the image seems to be cached as it's only uploaded once and > never gets updated after. If I click on refresh or clear the cache on > the web browser, the image will be updated. I added non-caching > headers, tried it on IE, Firefox, and Opera with all caching and > cookie options disabled, added random number behind the URL called by > Ajax.PeriodicalUpdater, made the image really small and simple, .... > nothing works. I wonder why Ajax.PeriodicalUpdater can't update image? > I tested the function with text and it works perfectly fine. Is it > browser or Ajax.PeriodicalUpdater issue? > > On Aug 28, 3:35 pm, "Nicolás Sanguinetti" <[EMAIL PROTECTED]> wrote: > > > for repeating execution you need setInterval, setTimeout only calls it > > once, or better yet (at least if you need more control) use > > Prototype's PeriodicalExecuter. > > > -foca > > > On 8/28/07, Diodeus <[EMAIL PROTECTED]> wrote: > > > > Yes, in this case use > > > Ajax.Request:http://www.prototypejs.org/api/ajax/request > > > > ..then just use setTimeout to keep calling the function periodically. > > > > On Aug 28, 1:12 pm, S <[EMAIL PROTECTED]> wrote: > > > > Yes, I'm a newbie in using Ajax and I don't use javascript a lot > > > > either ( I didn't even know what JSON was :P ). I was trying to save > > > > the value returned byAjax.PeriodicalUpdater, which I realized later > > > > that it's not gonna work. It only updates the value inside div > > > > directly. In that case, I'm forced to go to a totally different > > > > direction. Thanks Diodeus and Michael for your suggestions. I really > > > > appreciate it :) > > > > > On Aug 27, 3:30 pm, Diodeus <[EMAIL PROTECTED]> wrote: > > > > > > While I generally use JSON myself, judging from the skill level of the > > > > > original poster, I would expect JSON would be a bit of a leap. > > > > > > On Aug 27, 3:17 pm, Michael Peters <[EMAIL PROTECTED]> wrote: > > > > > > > Diodeus wrote: > > > > > > > Create some sort of unique delimiter in your responsedatastring to > > > > > > > separate the elements, such as "~". > > > > > > > You could do that, but then you're limiting yourself (limiting > > > > > > yourself to just > > > > > > arrays and whatdatacan be in those arrays). Why not just use JSON? > > > > > > Convert > > > > > > your PHP structure (array or hash) into a JSON string and then send > > > > > > it over the > > > > > > wire. > > > > > > > > Then turn the string into an array using (use your own variable > > > > > > > names): > > > > > > > > mydata = myResponseText.Split('"~") > > > > > > > > mydata[0] will contain the first element, mydata[1] the second > > > > > > > etc. > > > > > > > This would then become > > > > > > > mydata = myResponseText.evalJSON(); > > > > > > > -- > > > > > > Michael Peters > > > > > > Developer > > > > > > Plus Three, LP- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
