Closed (fixed)
Project:
Image javascript crop
Version:
6.x-1.x-dev
Component:
PHP
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Oct 2008 at 00:36 UTC
Updated:
11 Mar 2010 at 11:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
Kripsy commentedUnfortunately I could not get this patch to work. I tried it against the dev build (which supposedly has the disable cropping patch already applied) but the actual aspect ratio isn't kept. I assume that the patch just isn't applied correctly to the dev build, I guess I need to dig around the CVS.
Comment #2
Kripsy commentedFalse alarm. I had to update the database. Sometimes I wonder about myself, but I can confirm that this patch works great. It is also exactly the feature I was looking for. With this patch enabled + a scale filter I can get regular looking thumbnails easily.
Comment #3
neochief commentedComment #4
derjochenmeyer commentedThanks for the patch! works great!
note: I had to delete all previously set up imagecache presets (only the ones with javascript crop) and create new ones to get it to work.
Comment #5
swortis commentedI'm not able to get the aspect ratio to work. Have successfully run the patch; deleted and then recreated the imagecache preset; and then ran update.php.
The cropper itself works but the not the aspect ratio, and so the thumbnail is neither square, nor the correct size.
Anyone have any suggestions?
-S
Comment #6
swortis commentedTo be clear: My expectation was that if I created a 90X90 thumbnail imagecache preset with the aspect-ratio selected, that a user would then be able to select and move a square cropping area across their uploaded image; hit the crop button and have a final thumbnail sized at 90x90 - and custom centered as they wanted.
Without the aspect-ratio selected, I would expect that the user could create a custom shaped thumnail.
Hoping this is what the patch was intending.
Comment #7
neochief commentedAs I remeber, It should work like you described.
Comment #8
swortis commentedI'm now noticing that (at least with FF - Mac) if one holds the Shift key, the cropping area retains the aspect ratio of the original image, but not of the imagecache preset
(Note: The final thumbnail is never the correct dimensions of the imageacache preset.)
Comment #9
guillaumeduveauHi,
I've updated the patch against CVS DRUPAL-6--1.
I couldn't agree more with neochief's refactoring, however I didn't include it in that patch, in order the maintainers to be able to see better what happens there. I could roll a new patch with the refactoring if the maintainers ask me to.
This patch is a little deviation from neochief's, it allows :
- to resize the crop area while keeping a determined numeric ratio like 0.75, 2 or 1 if you want a square
- to resize the crop area while preserving the original image ratio. It's the behaviour swortis noticed but it's not universal (does not work on FF 3.0.11 Ubuntu) : jQueryUI resize with aspectRatio: false
- to resize the crop area without taking into account any ratio (normal behaviour of ImageCrop)
Please note that when resizing, you change the crop width and height that were set. This is even in -dev without this patch. So you have to put a Scale action after the ImageCrop action.
Comment #10
luckysmack commentedpatch in #9 was patched with no problem and seems to work. the resulting crop (in views) seems to be a different size but i believe thats a seperate issue. thanks again. The only thing that seemed od was the description of the aspect ratio. Might not make sense to some, possibly a better description that the number entered is the width compared to the heigth. so a 2 is a 1 height by 2 wide image. I at first though i had to enter a width and a height, or something like "1:1" in the box. Anywho, i got it to work fine. No issues other than stated.
*EDIT: ok it seems the image that is rendered in views is the proper dimensions i need, so somewhere the ratio is changing. I am stating this here as i never noticed it before. Heres what im doing.
imagecache preset: img-square-crop -> javascript crop: 100x100, keep aspect ratio: 1
imagecache preset: img-80x-square -> scale and crop: 80x80
the imagefield has the permissions to user img-square-crop. basically the user can upload any image and the crop region starts out at 100x100 and can resize to any size desired keeping a 1:1 aspect ratio. the resulting image can obviously different sizes, this is so i can use a straight square crop and only use 1 preset for it to keep the ratio set to 1:1
now, in views i have a "content -> field_img_test -> img-80x-square" that grabs the same cck field. when the image is displayed in views it is the true 80x80 dimensions I need but has a larger area than what was cropped (in height). so it seems that when the image is actually cropped the dimensions are not correct, unless im doing something wrong. the cropping area is locked to a 1:1 ratio so should be a square and should fit nicely into the 80x80 thumbnail in views; which is 80x80 but has more of the original image's space inside that 80x80 area
Comment #11
mrfelton commentedSorry to cross post, but can someone offer me some help please... I can't seem to do resizing at all - see #652022: No ability to resize crop
Comment #12
mrfelton commentedok, my previous issue was resolved by updating jquery_ui and installing a theme for it (see the thread mentioned above).
I like the idea of constrained proportions, however what I need is the ability to constrain the aspect ratio to that of the crop dimensions specified in the javascript crop action. That seems like the most sensible thing to do. TBH I can't see why you would want to constrain the crop to it's original proportions. But to be able to specify the crop size in the imagecache preset, and then give the user the ability to resize the crop but constrained to THOSE proportions would be really useful.
Comment #13
mrfelton commentedHere is my version of the patch. It adds to the one in #9, giving another option of 'CROP' which constrains the aspect ratio to the dimensions specified in the javascript_crop preset.
EDIT: I also reworded the help text to be a little more clear (I hope!)
Comment #14
magnestyuk commentedAfter applying the patch above (#13), after I click on the "click here" link in the popup window, the next page comes up totally empty. Can someone clarify whether I need a jquery update (to 1.7.2) to get it to work or some commonly overlooked version conflict anywhere in the related modules?
Thanks.
Comment #15
mrfelton commented@magnestyuk: Only way could get it to work was to update to the latest jquery (jquery_update) jquery ui (jquery_ui) and apply the patch from http://drupal.org/node/388384 and install a jquery_ui theme.
Comment #16
magnestyuk commentedThanks for the quick reply. Do you mean latest dev versions or latest stable?
Do I need jquery update 6.x-1.1 or 6.x-2.x-dev? I have jquery_ui 6.x-1.3; do I need 6.x-1.x-dev?
Thanks again!
Comment #17
mrfelton commentedjquery update 6.x-2.x-dev
jquery_ui 6.x-1.3
jquery.ui 1.7.2
The patch for ui theme support, and a properly installed theme.
Comment #18
magnestyuk commentedI have all the right versions of everything, patched where needed, triple checked, and it still goes to an empty screen. I switched back to the original dev version of imagecache javascript crop, with no luck. I have 6.x-2.0-beta10 of imagecache. Should I?
@mrfelton, I would very much appreciate if you attached your working version of the imagecrop folder, so that I can start looking elsewhere if your version doesn't work for me.
Comment #19
magnestyuk commentedI finally found out what was wrong. I set the "Step size for scale dropdown" to 0 at some point in the hopes of getting rid of the dropdown select. Now I know I shouldn't have. @mrfelton, thanks for your help.
Comment #20
mrfelton commentedFixed in CVS: http://drupal.org/cvs?commit=333520