I'm having an issue where I can upload and apply a crop area to an image when a node is created, but when the node is edited next the crop area is not applied. This means every time you edit a node the crop has to be reapplied.

I'm running Drupal 6.17 and the latest version of all other modules...

The settings I am using are:
The resolution to crop the image onto: 94x94
Enforce crop box ratio: Yes
Enforce minimum crop size based on the output size: Yes
The resolution of the cropping area: 500x500

Is anyone else encountering this issue?

Comments

sydneyshan’s picture

Title: Crop area not applied when node is edited » Crop area reset when node is edited
troyer’s picture

Same problem here, crop area isn't retained when I edit a node where a crop area has been defined. This error has creeped in in the RC2. I didn't have this problem before.

sydneyshan’s picture

StatusFileSize
new168.76 KB
new6.5 KB

I've attached both the generated HTML and a snapshot of the issue in the hopes this may help troubleshooting...

sydneyshan’s picture

Attached is the serialized data from the content type's image data and the HTML before it has been affected by the Imagefield Crop jQuery. I can't see any reference to the height/width/offset of the previously specified crop, therefore it wouldn't be applied to the cropping area when editing the node/imagefield.

sydneyshan’s picture

If I don't touch the crop interface when editing the node the existing thumbnail is retained.

It would be better if the image crop interface would match the previously selected cropping area so as to avoid confusion - I'm sure it has worked like this in the past...?

troyer’s picture

@sydneyshan are you using the jquery update module or something related?

I'm asking because I rolled back to RC1 and the problem persists, so it must be some other module interfering.

sydneyshan’s picture

@drupidoo I've disabled both the jQuery Update and the jQuery UI modules but the problem still persists. I have a working version of Imagecache Crop on our intranet so will investigate the differences between the two environments today. My colleague has been making some jQuery/jQuery UI updates so I'll check in with him to ensure the core hasn't been hacked or anything...gasp! Will check back in shortly.

sydneyshan’s picture

Okay, I've figured out this is a conflict with the Filefield module's Filefield Meta sub-module. Disabling Filefield Meta from the modules list works a treat.

Further investigation in to why Filefield Meta seems to be overwriting or messing up the cropping data supplied by Imagefield Crop needs to occur.

troyer’s picture

@sydneyshan I can confirm this. Only disabled the Filefield Metadata module and now Imagefield Crop is back to normal. Not perfect but since I'm not using the Filefield Metadata module it's a workaround for now.

greenskunk’s picture

A site I work on does NOT have the Filefield Metadata module enabled and yet when editing ignores my selection and the preview area does not show a new preview when you crop. Does not remember your cropped selection either when editing a node again.

Lets see what happens when I disable some modules.

m_z’s picture

@GreenSkunk: Same for me. I also have the problems with Image Crop when editing a node, but I don't have activated the FileField Meta module.

It seems to be another module which can cause this problems. Maybe it is the same reason so any deeper insight would be welcome!

Here some modules which are activated on my Drupal 6.19 installation:
- Content 6.x-2.8
- FileField 6.x-3.7
- Image crop 6.x-1.0-rc2
- ImageField 6.x-3.7
- FileField Paths 6.x-1.4
- jQuery Update 6.x-1.1
- jQuery UI 6.x-1.3

Any ideas?

m_z’s picture

After writing #11 I did some experiments with a fresh installation and the modules mentioned above.

Good news first: jQuery Update and jQuery UI don't seem to affect ImageField Crop module.
I found that FileField Paths module causes the strange behaviour that inside your "Crop area" the cropped and NOT the original image will be shown.

If you don't want to change your image while editing a node, you will have one of the following cases:
1.) If your cropped image has the minimum size, than it remains unchanged after you finished editing a node by clicking the save button at the bottom. (The dashed line is at the border of your Crop area.) --> This case is the better one.
2.) But if the cropped image is bigger than the minimum size, than there is a very strange behaviour: The cropped image will be cropped again with the selection in your Crop area that you selected while creating the node. (The dashed line is inside your Crop area.) --> This case is very bad.

The problem occurs right after enabling FileField Paths module. I didn't even set a path for my imagefield... Very strange...

greenskunk’s picture

Great job M_Z! On most of Drupal installations, I setup the FileField Paths module. It must have been something with one of the latest releases.

I've got a dev area that I'll try to trace this down on.

m_z’s picture

Hi,

I got some new insights: The problems seems to occur only, if you are trying to upload an image file with the same filename more than once (like most of us will do while testing such a module... :)

Easy workaround: use filefieldpath to rename the uploaded image file by adding the upload timestamp or the node updated timestamp or something else which makes the filename unique.

There is something wrong with the file renaming in imagefield_crop / filefield_path when a file name occurs multiple times...

pcambra’s picture

Adding [raw] to filepath settings of the field solves the problem, thanks M_Z!

jlongbottom’s picture

Version: 6.x-1.0-rc2 » 7.x-2.0

This has been happening to me with the latest non-dev version 7.

Renaming and re-uploading the file seemed to fix it. I have not been able to reproduce it since. Weird.

jlongbottom’s picture

This has been happening to me with the latest non-dev version 7.

Renaming and re-uploading the file seemed to fix it. I have not been able to reproduce it since. Weird.

joetsuihk’s picture

Version: 7.x-2.0 » 6.x-1.0-rc2
Status: Active » Fixed

@eSentrik please try 7.x dev version.

Also, from the discussion, it seems the problem exists in filefield_path rather than imagefield_crop

rc2 is years ago, I am marking this fixed, assume 1.0 version already fixed this. Please re-open this to 6.x version only.

For 7.x, please open a new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.