Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(js/jquery) Rotating an image in FF/Saf/Chrome without Canvas OR Zooming a canvas item

I am working on a project where I need to rotate and image to the users' liking then allow them to zoom a bit in and out.

Using jquery.rotate.1-1.js in IE everything works perfectly (how rare) as MS wrote their own rotation tool (progid:DXImageTransform) so the img is rotated and then kept as an image. However looking at the JS I see that if the browser is not IE then a canvas is rendered (i've never really used canvas) which means that once the canvas is drawn with the image rotated I cannot zoom in on the image because if I understand it correctly the canvas doesn't actually hold the information.

I've also attempted CSS3 transforms with my non-IE browser and have everything rotating correctly however when I try and zoom it's using now non-existant div sizes.

Are there any tools out there that allow rotation and then zooming on the client-side? OR Is there a way to rotate an img tag in FF/Chrome/Saf & maintain the rotate image after?

like image 858
Stu Avatar asked Nov 01 '10 17:11

Stu


2 Answers

There are some transform CSS version in all current web browsers. I use the following styles for rotation:

.rotate
{
    -webkit-transform: rotate(-90deg);    /* Safari 3.1+, Chrome */
    -moz-transform: rotate(-90deg);       /* Firefox 3.5+ */
    -o-transform: rotate(-90deg);         /* Opera starting with 10.50+ */
    -ms-transform: rotate(-90deg);        /* IE9 */
}
.rotateOldIE
{
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE6, IE7 */
    -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=3)"; /* IE8 */
    zoom: 1;
}

If you search for the CSS styles you will find detailed description of any from the above CSS styles and you will find many examples.

like image 116
Oleg Avatar answered Sep 21 '22 20:09

Oleg


You can check this tool [http://css3.mikeplate.com/][1]

[1]: http://css3.mikeplate.com/ it will allow you do all transformation and see them on the fly so you can test it on different browsers, it allow zomming and rotating

like image 28
Samir Adel Avatar answered Sep 22 '22 20:09

Samir Adel