Is it advisable to use a handler to display Images ? the issue is i cannot right click and save these images .It shows the Handler name and Asp.net Generic handler as save type so i cant save the image but the GUI image is amazing in quality.I am showing a single image in different sizes using 2 handlers and the code works fine but if then if I don’t use the Handler i have to re size them individually and then store them in different folders.
Share
I’ve successfully used this method on sites before, but it’s only of use if your particular case is suitable. If you can do it using HTML and your images are the correct size on the server, then it’s probably overkill.
If you find yourself saving several copies of the same image then you may benefit from manipulating it on the fly.
In my scenario, using a .ashx handler enabled me to upload just one large hi-res image per subject and then transform it for use in several different ways:
Then it was just a case of calling it from a custom Image control and passing the correct parameters in.
EDIT :
Regarding saving the images, I can do it fine in mine as long as I force the .ashx extension that the browser tries to give it to be JPEG (or whatever).
I can’t give you a full working .ashx example, and there are so many sub-topics you’ll need to consider:
Graphicsobject in .NETAs a small example (in VB.NET), here’s a simple method to resize an image given the new width and height: