1

I am trying to build an application which serves images to a Deep Zoom MultiScaleImage dynamically. For example, when an image for a particular corner of the large image is requested, that image should be rendered automatically.

Rendering is what I will implement. But my code needs to be called when the MultiScaleImage requests that corner of the image. How do I implement this?

When I search on StackOverflow for this, I get results that explain dynamic generation of deep zoom images using DeepZoomTools. I am not entirely sure, but this is not I want. I want to generate images only when requested individually and not generate all of them on the fly.

EDIT: Let me give you an example that will explain one of the possible solutions to this, which I don't know how to implement.

If the MultiScaleImage requests the image 5/1_0.png, which if you know Deep Zoom will be the first image in the second column of the large image at 5th zoom level (not related to the real zoom value in deep zoom). When the DeepZoom requests this file, I want to generate it looking at the parameters I have, which are "5", "1", and "0".

Salil
  • 88
  • 9
  • 1
    You could use routing (e.g. http://www.4guysfromrolla.com/articles/012710-1.aspx) to direct the request to a Web Generic handler. – Andrew Morton Feb 26 '12 at 18:14
  • (sorry for my bad english) - I'm not sure if is this you want but the Pivot Viewer JIT sample does something like this. Look here (http://geekswithblogs.net/tkokke/archive/2010/08/17/runtime-pivotviewer-collection-creation.aspx) - the link to the sample on this article is broken, you could get it here:http://www.silverlight.net/learn/data-networking/pivot-viewer/download-just-in-time-tools# I do not know if the pivot format is the same of deepzoom but it maybe gets you a start point :) – Leo Feb 26 '12 at 20:28
  • @AndrewMorton That looks exactly like what I want. You might want to make that as an answer so that I can accept it. Also, now that I am able to route a request to a handler, which will be in an ASPX page, I was wondering how I could reply back with an image, instead of HTML content. I believe it would require me to modify the response headers. I haven't looked into this much. EDIT: OK wonderful! I found what I wanted: http://www.sitepoint.com/generating-asp-net-images-fly/ – Salil Mar 01 '12 at 06:52

1 Answers1

1

@Salil: will do. You could use routing (e.g. https://web.archive.org/web/20211020111718/https://www.4guysfromrolla.com/articles/012710-1.aspx) to direct the request to a Web Generic handler. Note that a generic handler is a bit more suitable than an aspx page as it doesn't have to do so much work with a page lifecycle.

Andrew Morton
  • 24,203
  • 9
  • 60
  • 84
  • Okay I got it working. But the images I generate are being cached. I am not sure what part of the stack is caching it. Is it the browser? In this case how do I prevent Silverlight from caching the deep zoom images? – Salil Mar 09 '12 at 08:05
  • 1
    I'd start by setting a response header in the handler (http://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Avoiding_caching) and if that doesn't work you can do a web search for "silverlight prevent caching". – Andrew Morton Mar 09 '12 at 13:21
  • Great! That worked. I didn't think of modifying the ASP .NET response. I had been searching "silverlight prevent caching" and "deep zoom prevent image caching" but didn't find anything concrete. Thanks! – Salil Mar 09 '12 at 16:59
  • Okay that worked when I refresh the browser which was quite satisfactory for what I was doing then: It didn't show me images from old code and would show me updated images. But now I want the images to update when I zoom in and zoom out (I am rendering the current DateTime.Now.Second value to the image). But the image shown on zoom out is still the old one. – Salil Mar 20 '12 at 07:06
  • I found this one too. There's a method called InvalidateTileLayer in the MultiscaleImageSource class on protected protection level. When you call it, the MSI will re-request an image from the URL so that you can draw something new! – Salil Apr 15 '12 at 10:31