Silverlight DeepZoom Service Demo Project - Silverlight Client/WCF Upload/DeepZoom XAP package
I was working on a poc (proof of concept) to write a DeepZoom Service using Silverlight. The idea is to provide a deep zoom service which will allow any client to consume a deep zoom service to upload an image or images to a server and the client can embed deepzoom image without worrying about storage / location and the service can be integrated in an ecommerce app. I thought I will share this POC here, in case anyone needs the similar service.
Below are the steps I followed
1. Write a windows service to be installed on a client machine with a configurable folders which can be monitored to upload images using WCF Upload Service.
2. Write a web user interface which can be hosted on any webserver to upload an image, I used an html file with silverlight control hosted on Apache Web Server, it allows user to upload an image. once the image is uploaded, it publishes the link to preview the deepzoom image
Download the client source code here
3. Write a WCF Upload service to used by silverlight client hosted on apache server
Download the wcf upload service source code here
4. Write a Windows Service which runs on a server and monitor the configured folder to watch for uploaded images. As images are uploaded to server, it does the followings
a. Generate deep zoom images using DeepZoomTool library(installed with deepzoomcomposer)
b. Move the file for back up
c. Create a xap package with deepzoomimage
d. Generate a test html page hosting the above xap package
5.In order to embed deepzoom image in a page, all you need to do is include a div tag and specify the location of .xap file which will be the http://<deepzoomservice url>/<some unique id to identify each user or a customer>/imagename/imagename.xap
<div id=”silverlightControlHost” style=”height: 100%;”>
<object data=”data:application/x-silverlight,” type=”application/x-silverlight-2″ width=”100%” height=”100%”>
<param name=”source” value=”<uri>/<imagename>/<imagename>.xap”/>
<param name=”onerror” value=”onSilverlightError” />
<param name=”background” value=”white” />
<param name=”minRuntimeVersion” value=”2.0.31005.0″ />
<param name=”autoUpgrade” value=”true” />
</object>
</div>
Silverlight assembly(to host deepzoom image) can be manipulated by injecting IL without needing to recompile the code if needed.
I have not made the windows service source code and xap package generator available yet because it is still under progress but a very simple implementation to generate deepzoom images with default values is nothing more than making call to deepzoom api. Although, DeepZoom apis are a little more involved for finer control of deep zoom image generation.
new Microsoft.DeepZoomTools.ImageCreator().Create(metadata.Source, metadata.Destination); generates the deepzoom image
I can make it available for download, in case anyone is interested.
Tags: Silverlight
September 8th, 2009 at 5:47 pm
Hello,
Very interesting post.
I’m looking into the feasibility of turning a standard photo gallery website into something a bit special for a client and I’m intrigued with what you have achieved
I was wondering if you could say how feasible it would be for me to create a situation where my client could upload an image to a server where it would be automatically processed as a deep zoom xap? And what would be required, on the server to do this. I’ve followed your post as best I can - but I am a novice!
Please excuse me if my question is rude or simplistic - I really am just trying to get my head round deep zoom.
Thx,
Ewan
[Reply]
prashant Reply:
September 9th, 2009 at 7:49 am
@ewan,
Hello Ewan,
It will be failrly easy to solve your problem. You don’t need any special software as such other than .NET framework on Windows Server. I will make the complete demo project (visual studio solution) available for download, if not tomorrow then sometime this week for sure. This demo project will include a silverlight website to upload a file, a wcf upload service used by client to upload images, windows service to process those uploaded images and generate xap package, a test console app to process uploaded images(so that code can be tested without using install util to install the windows service and I find it easier to debug). I will put a little description against each of the project. Since this is a demo project so code base is small and most of it will be self explanatory otherwise feel free to ask away any question you may have.
Thanks,
Prashant.
[Reply]
September 9th, 2009 at 11:35 am
Hello Prashant,
Thank you for your fantastic response - not everyone is so helpful
I will certainly have a look at the demo when posted.
Thank you again,
Ewan
[Reply]
prashant Reply:
September 14th, 2009 at 7:48 am
@ewan,
Ewan,
I have made it available for download on today’s post http://debuggingblog.com/wp/2009/09/14/deepzoom-demo-download-uploading-images-and-the-auto-deepzoom-xap-generation/
Hopefully, this is helpful. If you just want to test it from end to end, please read the “READ ME” section on post.
Cheers,
Prashant.
[Reply]