cms icon indicating copy to clipboard operation
cms copied to clipboard

Focal point not saved when blueprint has no fields

Open marcusand opened this issue 4 years ago • 7 comments

Bug Description

When setting a focal point on an image which is connected to an empty blueprint, the focal point is not saved.

How to Reproduce

  • delete all fields in the blueprint of the asset container so that it has no fields
  • set a focal point on one of the assets
  • look in the meta data file --> only last_modified is updated

Environment

Statamic 3.0.31 Pro Laravel 7.29.3 PHP 7.3.24 statamic/migrator dev-master

Install method (choose one):

  • Fresh install from statamic/statamic

marcusand avatar Dec 02 '20 12:12 marcusand

Seems to be working fine for me. I removed all the fields from my asset container's blueprint so it was left looking like this:

sections:
  main:
    display: Main
    fields: {  }

I then opened up one of my asset's meta yaml files in my code editor, and removed its contents. Then I went into the Asset library, set a focal point and saved my changes. I then confirmed that there was data set inside the asset's meta yaml file, including the focal point.

The focal point also changed fine for me when I updated it.

duncanmcclean avatar Dec 08 '20 22:12 duncanmcclean

I am not sure about you guys, but I just experienced that issue again and it bugs me a lot...

Statamic 3.2.17 Pro Laravel 8.66.0 PHP 8.0.8 No addons installed

Asset blueprint has no fields and the meta file of the asset looks like this:

data: {  }
size: 30886
last_modified: 1635353102
width: 1440
height: 2880
mime_type: image/png

When I then try to update the focal point, its not saved to the file! Annoying! Can someone try to reproduce?

marcusand avatar Oct 28 '21 08:10 marcusand

Can you provide a repo with this problem reproduced?

jasonvarga avatar Oct 28 '21 14:10 jasonvarga

@jasonvarga I just reproduced this issue in a fresh install. so really nothing special configured. but anyways I created a repo: https://github.com/marcusand/statamic-focal-point-issue try to set the focal point on the image in the "main" asset container. does not work for me.

marcusand avatar Oct 29 '21 12:10 marcusand

I can recreate it if i don't save any asset meta data before removing the alt tag on a container blueprint. This might be a helpful clue. 🕵️‍♀️

jackmcdade avatar Mar 04 '22 21:03 jackmcdade

Was able to just reproduce it on a fresh 3.3.14 via CLI. I had to edit the blueprint from the CP and just hit save without doing anything else to the blueprint for the alt text and focal point to get saved. If the assets.yaml is like @duncanmcclean's it also doesn't save the focal point.

joshuablum avatar Jun 09 '22 13:06 joshuablum

I looked into this and just wanted to let you know that I have found a fix for this and will open a PR at start of October for Hacktoberfest. Just in case anyone else planned to pick up this issue.

ncla avatar Sep 20 '22 18:09 ncla