Use image OnLoad event in JavaScript. In other words, do not load a new image until the last one is not completely loaded.
Probably you shouldn't use Update panel. The image tag (including its size, look and position) remains the same; it's the source which changes. Rather than updating everything, I suggest to do the following on client side:
- At the beginning, load the first image (without Update panel).
- Add a listener to the
OnLoad
event to <img />
on client side.
- When the picture is fully loaded, reload it by querying the server for a more recent picture. For example, you may consider having an ASP.NET page
Camera.aspx
which serves the most recent pictures grabbed from the camera. To be sure the page is really queried, change the src
property of <img />
element to Camera.aspx?t=1
, Camera.aspx?t=2
, etc.
On server side (so no JavaScript here), the grabbed images are stored in database, so Camera.aspx
will query for the last stored record, retrieve it and send directly to the client (specifying appropriate Response.ContentType
and using Response.OutputStream
).
To achieve better visual response, you may also want to consider using two image elements in parallel: when the first one is loading, the second is displayed, and vice versa. It might be better, but I'm not sure, so test before choosing the appropriate method.