blueimp/jQuery-Image-Gallery — Issue #8: embed rotate controls and functionality
Author: tsilik
Created: 2012-01-20 12:55:12+00:00
State: open

Would it be possible to to have two rotation buttons somewhere on the image?
I managed to write a function to handle the rotation to the right (when canvas=true)

```
_rotateRight: function () {
var canvas = $('canvas').get(0);
var ctx = canvas.getContext('2d');

var data = canvas.toDataURL();

var tmp = canvas.width;
canvas.width = canvas.height;
canvas.height = tmp;

var rotImg = new Image();

rotImg.onload = function() {
ctx.save();
ctx.translate( canvas.width, 0 );
ctx.rotate(90 * Math.PI / 180);
ctx.drawImage(this, 0, 0, canvas.height, canvas.width, 0, 0, canvas.height, canvas.width);
ctx.restore();
};
rotImg.src = data;

return true;
},
```
Could someone help for adding the controls to the dialog?
Thanks in advance.

ps. Also I am aware that the canvas selection is not appropriate.(how could i point to the canvas of the respective dialog?)