Hi,

When using image_widget_crop with filefield_paths the crop informations are saved with wrong file path.

To reproduce the problem:

Add the image_widget_crop widget to a content.
Upload an image then set the crop and save.

The crop informations are saved in database with the initial file path, like "public://filefield_paths/drupal-8.png" instead of the final file path like "public://pictures/{uid}/news/{nid}/gallery/drupal-8.png".

If I reopen the node in edit mode and re-apply the crop, this time it save with correct file path and crop is successfully show on the view mode page.

I don't know if it's this module or the image_widget_crop module to manage the problem...

Thanks in advance for any suggestion.

Comments

titouille created an issue. See original summary.

Algeron’s picture

Status: Active » Needs review

Encountered the same problem with the Focal Point module.
#2793727: Focal point not saved on insert when using the Filefield Paths module

Take a look at the patch in that thread. The solution for image_widget_crop will probably be very similar.

I don't think it's a bug in FPP per se, but considering it's likely to occur again in other modules, perhaps it's possible to execute FPP's logic earlier in the chain.

woprrr’s picture

I purpose my support to solve that issue :)

My first thing this problems is same with other effets on image_field (i suppose yes IMHO). Can we clear this point ?

After small search i ve discover that, all ImageEffects is impacted (ImageWidgetCrop (crop effect), focal and rotate core effect etc ...) The original image is delivered instead of derivative in second load and is that already an issue #2702227: Image styles for private files are serving the original instead of derivative.

Finally fixed and not lie to this issue.

woprrr’s picture

After small tests / review of problem i ve small problems with approach to override the file process with "filefield_paths_filefield_paths_process_file" This seems break all process of module to extend imageWidget.

I need more time to are sure but if we comment (filefield_paths_filefield_paths_process_file()) IWC work with your module.

woprrr’s picture

Status: Needs review » Closed (duplicate)

Duplication of #2811559: Crop not saved on insert when using the Filefield Paths module and fixed on ImageWidgetCrop with collaboration of Algeron. Thanks a lot.