I have an approach in mind for an image viewer in a web app, and want to get a sanity check and any thoughts you stackoverflowers might have.
Here's the whirlwind nutshell summary: I'm working on an ASP.NET MVC application that will run in my company's retail stores. Even though it is a web application, we own the store machines and have control over them. We have a "windows agent" running on the store machine which we can talk to from the browser via javascript (it is a WCF service, and our web app has permission to talk to it from the browser).
One of the web pages needs to be an "image viewer" page with some common things like Rotate & Zoom.
Now, there are some WebForms controls that offer Rotate and Zoom. However, they take up server resources and generate a good bit of traffic between the server and the browser. For example, the Rotate function would cause an ajax call to the server, which would then generate a new image written to a .NET Canvas object, which would then be written to a file on the server, which would then be returned from the ajax call and refreshed inside the browser.
Normally, that's a pretty good way of doing things. But in our case, we have code running on the store machine that we can communicate with. This leads me to consider the following approach:
- When the user asks to view an image, we tell our "windows agent" to download it from our image server to the store machine.
- We then redirect our browser to our image viewer page, which will pull the image from the local file we just wrote to the store machine.
- When the user clicks "Rotate", we cause JavaScript code in the browser to call our "windows agent" software, asking it to perform the "Rotate" function.
- The "windows agent" does the rotation using the same kind of imaging control that would formerly have been used on the server, but it does so now on the store machine.
- Javascript in the browser then refreshes the image on the page to show the newly rotated image.
Zoom and similar features would be implemented the same way.
This seems to be much more efficient, scalable, and responsive for the end-users. However, I've never heard of anything like it being done, mostly because it's rare to have this combination of a web app plus a "windows agent" on the client machine.
What do you think? Feasible? Reasonable? Any pitfalls I overlooked or improvements / suggestions you can see? Has anyone done anything like this who would like to offer the wisdom of experience?
Thanks!