Could someone confirm that I'm barking up the wrong tree? I saw something about the 2.x-dev version working if I fix some other chunk of stuff somewhere... I'm just looking for a guide to show me how this is being done with the current version of core.

Comments

lamefork’s picture

I'm having a similar issue. When uploading the image the file is displayed along with the cropping tool, but upon saving the file is not retained.

I had attempted a patch I found somewhere, and it made the file save, but failed to produce a cropped section of the image on the node.

rodmaz’s picture

Priority: Normal » Major
StatusFileSize
new166.88 KB

Installed on 7.10 and it is not working.
It displays the component, allows cropping. But there is no preview button not crop button is the form.
When saving the node, no changes are retained.

bdu’s picture

I originally stated that on my development site 7.x-2.x-dev works ok with 7.10, but that is not true
right now, not sure if my earlier test where flawed or that something else broke it. The net effect is
that you can crop but the crop values are not stored.

rodmaz: in your picture the cropped preview image looks to be the upper left hand corner, instead
of the selected area. Looks to be something with the crop position.
(internally the image is transformed twice: first it is cropped then scaled)

mpotter’s picture

StatusFileSize
new12.73 KB

The 1.x-dev version wasn't working for me on Drupal 7.10 either. In my case I also needed the ability to turn off the fixed output size, so I was trying to use the patch in #1139762: Errors when output resolution is set to 0 (comment #2). But I found that the line in imagefield_crop.js

        // get the name attribute for imagefield name
        var widget = self.parent().parent().parent();

needed to be changed back to this:

        // get the name attribute for imagefield name
        var widget = self.parent().parent();

I also needed the functionality from 2.x that sets the initial crop selection to the entire image. Sorry to mash this all together, but since I finally got imagefield_crop 1.x to work on Drupal 7.10, I thought I'd post my entire patch from 1.x dev so other people can also play with it. Good luck!

bdawg8569’s picture

I am also having problems getting 7.x-1.0 working on D7.10. I have tried the patch in #5 but I still can't get things working. I get a message that Hunk 7 and 8 fail but it looks like the right code is there when reviewing manually. Anybody else having luck getting this to work?

bdu’s picture

My first attempt was to apply the patch to the 7.x-1.x-dev release but that failed. The second attempt was to pull the imagefield_crop from git and the patch applied cleanly on top of that. (the 'Version control' tab on the imagefield_crop project page has the exact git commands, if you select 7.x-1.x as 'Version to work from').

Cropping an image works, preview shows the correct image and viewing the node with the cropped image shows the correct cropped image.

There is still an issue with height and width metadata, that only shows up when the image is used in views_slideshow. Then somehow the img tag has the wrong (original) size settings, distorting the page, but the image itself is correct.

bdawg8569’s picture

I was able to get the patch in #5 to apply cleanly as well using the advice in #7 by bdu. However, the cropping is still not correct. If you have the crop specified to maintain a certain output resolution, things work correctly, but if you are allowing users to crop the image to any proportion, the proportions are not maintained. It appears to me (from playing with it) that no matter how the new image is cropped, the old proportions are still being used. Therefore, if you take a large height dominant image, and crop it in such a way that it is not width dominant, the new image will be very distorted.

bdu’s picture

bdawg8569: can you check if the image itself is correct? For instance: Right click the distorted image and do 'View image'. This will show the image as it really is. (Its then just the markup that is wrong). An alternative is to inspect it with firebug, and compare the size to the tags.

bdawg8569’s picture

Bdu: you are correct. The image itself is correct when viewing the image by itself. I hadn't thought of that. I guess it is the markup that is wrong.

bdu’s picture

Then you are seeing the same issue as reported in #1345744: cropped image has incorrect metadata width and height in imagefield. The (dirty, hacking core) work around is modify image_file_presave() and have it always set the width and height using image_get_info() regardless if they are set or not.

bdawg8569’s picture

Indeed I am bdu. It is only an issue when you are free-cropping rather than cropping to a defined proportion.

bdu’s picture

The stored width and height in image_field are those of the original image, they are always wrong. If used with a style the correct layout is forced on top of the incorrect settings and that works as th image itself is correct. This issue is only visible when the cropped image is used without style.

bdawg8569’s picture

I used the patch from http://drupal.org/node/1415382 in addition to using the patch from #5 and have it working correctly.

ptmkenny’s picture

I was able to install the module and get it running in 7.12 with no noticeable problems.

mechler’s picture

I'm on 7.12 and 7.x-1.0 it isn't working for me out of the box. I'm looking in to the patches.