Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,


I stored images into database, my task is, in UI i have one image control and 3 buttons(Zoom In, Zoom Out and Rotate)

Listing of image to Sql DB and select one image to open on the image plateform And

To read the image from DB as byte[] and display this image into IMage control if the user click the Zoom In button then the image should zoomin, if the user click Zoomout then image shoud zoomout, if the user click the Rotate then the image should rorate)

How to do this in asp.net? Experts please help me. I dont know how to write the code for this?
Posted
Comments
Sergey Alexandrovich Kryukov 18-Jun-15 10:08am    
What are those images, bitmaps?
—SA

This will convert your byte[] to image and you can use it:
C# Image to Byte Array and Byte Array to Image Converter Class[^].

And after converting it, just place the three buttons under your image and using CSS transform[^] property you can zoom in, zoom out and rotate it. Though you'll need to use jQuery for the operations.

This would do ! :)

Still look at this article[^].

-KR
 
Share this answer
 
Here is a sample workaround, DEMO http://jsfiddle.net/yeyene/aGuLE/

JavaScript
$(document).ready(function () {
    $('#zoomIn').on('click', function () {
        zoomIn(1.2);
    });
    $('#zoomOut').on('click', function () {
        zoomOut();
    });
});

function zoomIn(zoomLev) {
    if (zoomLev > 1) {
        if (typeof (document.body.style.zoom) != "undefined") {
            $(document.body).css('zoom', zoomLev);
        }else {
            // Mozilla doesn't support zoom, use -moz-transform to scale and compensate for lost width
            $('#divWrap').css({
                "-moz-transform": 'scale(" + zoomLev + ")',
                width: $(window).width() / zoomLev
            });
        }
    }
}

function zoomOut() {
    $(document.body).css({
        zoom : '',
        position : '',
        left: "",
        top: "",
        "-moz-transform" : "",
        width : ''  
    });
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900