displayOnInit seems to be tied to ratioDim

25 views
Skip to first unread message

Neike Taika-Tessaro

unread,
Sep 10, 2010, 4:22:41 AM9/10/10
to javascript-image-cropper-ui
I was trying to integrate cropper into a website last night.

I was aiming for...

new Cropper.ImgWithPreview(
'thumbnail-image',
{
minWidth: thumbnailSize,
minHeight: thumbnailSize,
maxWidth: thumbnailSize,
maxHeight: thumbnailSize,
previewWrap: 'thumbnail-preview',
displayOnInit: true,
onEndCrop: thumbnailEndCrop
}
);

...with thumbnailSize being a variable I set before. I tried the
resulting cropper in [latest] FireFox/Windows7 and Chrome/Windows7,
both didn't show the cropper until I clicked on the image. I noticed
it was working fine in the demo, though, and started to try to figure
out what was different. After some trial and error, I got it worked
with:

new Cropper.ImgWithPreview(
'thumbnail-image',
{
minWidth: thumbnailSize,
minHeight: thumbnailSize,
ratioDim: { x: thumbnailSize, y: thumbnailSize },
maxWidth: thumbnailSize,
maxHeight: thumbnailSize,
previewWrap: 'thumbnail-preview',
displayOnInit: true,
onEndCrop: thumbnailEndCrop
}
);

Then it started up fine.

Is that deliberate, a quirk of the two browsers, or a bug?


Regards,
- pinkgothic

David Spurr

unread,
Sep 10, 2010, 6:41:18 AM9/10/10
to javascript-image-cropper-ui
Hi there,

It is deliberate, though for the life of me I can't remember why. I
guess it could easily be changed to use the minWidth & minHeight as
the starting value if that's available. It should be an easy change
for you to make if you look for the displayOnInit conditional in the
codebase. Let me know if you need further help with it, I might even
add it as default behaviour.

-D
Reply all
Reply to author
Forward
0 new messages