I agree that this module is a great method for managing photos for nodes. Thanks for the project.
Currently (at least on our website) the crop area defaults to the minimum width and minimum height for the cropped image (if there is no minimum in the admin settings page, then the crop area defaults to 0x0!).
I am using the 1.x version. It should include a setting for the default crop size. Ideally, the width or height of the image (maintaining ratio if also set in the admin screen) is read in and then the crop area that appears over the image is set to the maximum size for the original image. The website visitor may then reduce the size of the crop area.
Patch to follow.
Comments
Comment #1
jjchinquist CreditAttribution: jjchinquist commentedJust need a little help to determine the different values for Jcrop defined in imagefield_crop.js:
boxWidth: is this the width of the preview image on top of which the crop selector is placed, or is this the actual crop selector width?
boxHeight: same question as above.
Is there a javascript event that is fired when the image is loaded?
What event can I trigger that would cause the crop selector to resize when the preview image is loaded?
Thanks.
Comment #2
jjchinquist CreditAttribution: jjchinquist commentedOk - event trigger answer is the following:
http://deepliquid.com/content/Jcrop_Manual.html#Setting_Options
setSelect array [ x, y, x2, y2 ] Set an initial selection area n/a
boxWidth/boxHeight seems to be the cropping area (the image preview that the crop selector is placed on top of), not the cropping selector itself.
Comment #3
jjchinquist CreditAttribution: jjchinquist commentedPatch attached - please test/commit. Checked on 1 production website.
Comment #4
joetsuihk CreditAttribution: joetsuihk commented@jjchinquist thank you for the patch and sorry for this late reply, but can you explain "50" in
why is it 50?
Comment #5
jjchinquist CreditAttribution: jjchinquist commentedAs far as I know, the 50 px was a default "if nothing else applies". Please let me know if I should change this and I can.
Comment #6
mavimo CreditAttribution: mavimo commentedChanging approach, patch to set default cropping size to minimum value between width and height of image size as cropping area.
Comment #7
mavimo CreditAttribution: mavimo commentedFixed error on variable renaming.
Comment #8
valthebaldThis saved my day! Cleanly applies to the latest release. Can we get this in, please?
Comment #9
ram4nd CreditAttribution: ram4nd at Wunder commentedComment #10
ram4nd CreditAttribution: ram4nd at Wunder commentedRe-roll against latest state.
Comment #11
bluetegu CreditAttribution: bluetegu commentedI re-rolled mavimo's solution against latest 1.x dev, and centred the preview
Comment #12
tkuldeep17 CreditAttribution: tkuldeep17 at Axelerant commentedI am not able to apply patch jcrop-default-crop-settings-1506460-7.patch. It is failing. so creating new one.
Comment #13
tkuldeep17 CreditAttribution: tkuldeep17 at Axelerant commentedComment #14
tkuldeep17 CreditAttribution: tkuldeep17 at Axelerant commentedAdded setting for crop area ratio and position.
Comment #15
tkuldeep17 CreditAttribution: tkuldeep17 at Axelerant commentedSorry uploading path again. Fixing some errors.
Comment #16
prat CreditAttribution: prat commentedSubmitting patch agains 1.x dev, using @bluetegu patch, just changed the paths that were unnecessary included and thus causes issues on automated builds.
Comment #17
jenlamptonThanks for the patch @prat, still works for me!