statamic / cms

The core Laravel CMS Composer package
https://statamic.com
Other
4.05k stars 530 forks source link

{{ focus }} and {{ focus_css }} default value not working #3327

Closed jimblue closed 3 years ago

jimblue commented 3 years ago

Bug Description

As the Statamic doc says :

Focus return the focal point of the asset, defaulting to center (50-50)

On my side {{ focus | background_position }} and {{ focus_css }} are correctly returning the background position in percentage, but none returning '50% 50%' as default.

When the focal point is not defined it could be nice to get this default value returned.

Environment

Statamic 3.0.45 Pro Laravel 8.29.0 PHP 8.0.2 4rn0/statamic-v3-image-optimizer 1.0.5 jimblue/htmlmin 1.1.0 jimblue/instagram dev-develop jimblue/mapbox 1.2.0 jimblue/webpacker dev-develop statamic/seo-pro 2.1.3

robdekort commented 3 years ago

That would indeed be better. I just use this: style="object-position: {{ focus | background_position }}"

And if there's nothing there it does nothing, essentially the same. Not pretty though.