autorotate by orientation

67 views
Skip to first unread message

jkn

unread,
Apr 15, 2009, 10:28:52 AM4/15/09
to javascript-image-cropper-ui
hello,
i have a small problem: i will using the cropper to show users
different ratios on there uploaded images ... for example: 3:4; 16:9
or whatever. but when they upload an landscape oriented image (height
< width) or an portrait-image (height>width) they must manually rotate
the cropper-window. is it possible to autorotate the cropper window
oriented on the image dimension???

thx for your replay!
by
jkn

DEfusion

unread,
Apr 15, 2009, 11:00:59 AM4/15/09
to javascript-image-cropper-ui
Not out of the box, but you can do this in your code that attaches the
cropper, by providing the correct ratio for the image.

-D

jkn

unread,
Apr 16, 2009, 3:14:11 AM4/16/09
to javascript-image-cropper-ui
thx for your replay!

have you an small example??

best
jkn

f.p...@wedoo.it

unread,
Apr 21, 2009, 5:32:20 AM4/21/09
to javascript-image-cropper-ui
Hello!
i'm sorry i can't help for real... just trying. You should have
something like this:
Event.observe(
window,
'load',
function() {
var obj = new Cropper.Img(
'testImage',
<?
$gis = getimagesize($image);
$width = $gis[0];
$height = $gis[1];
if($width>$height){?>
{
ratioDim: { x: <?=$ratioWidth?>, y: <?=$ratioHeight?> },
minWidth: <?=$ratioWidth?>,
minHeight: <?=$ratioHeight?>,
displayOnInit: true,
onEndCrop: onEndCrop
}
<?}else{?>
{
ratioDim: { x: <?=$ratioHeight?>, y: <?=$ratioWidth?> },
minWidth: <?=$ratioHeight?>,
minHeight: <?=$ratioWidth?>,
displayOnInit: true,
onEndCrop: onEndCrop
}
<?}?>
)
}
);
generally speaking: you get the uploaded image sizes then set the
cropper ratio depending on width and height of the uploaded images...

could you explain me how did you manage to allow users to rotate the
cropper? i'm working on that, but can't get it... thanks!
Reply all
Reply to author
Forward
0 new messages