Problem/Motivation

The code tries to access non-existent properties $field->width and $field->height. While the $field variable exists, it doesn't have these properties accessible in this context, causing focal point position exported as (0, 0)

The code performs unnecessary conversions between absolute and relative coordinates using absoluteToRelative() during export and saveCropEntity() during import. These conversions are only needed for UI rendering, not for data storage.

Proposed resolution

1. Remove problematic width/height access: Remove references to `$field->width` and `$field->height` which don't exist in the current context.
2. Simplify coordinate handling:
- During export: Remove the absoluteToRelative() conversion and directly store the raw x and y coordinates from the crop entity
- During import: Use setPosition() directly with the absolute coordinates instead of saveCropEntity()

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

undertext created an issue. See original summary.

undertext’s picture

Status: Active » Needs review
rolodmonkey’s picture

Status: Needs review » Reviewed & tested by the community

I had this issue and the patch fixed it for me.

  • nginex committed a92c6641 on 1.4.x authored by undertext
    Issue #3549686: Simplify focal point export/import and fix invalid width...
nginex’s picture

Status: Reviewed & tested by the community » Fixed

This is now available in new release 1.4.14

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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