Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asset tag does not return asset object when used as "inline mode" #11257

Open
dadaxr opened this issue Dec 16, 2024 · 0 comments
Open

asset tag does not return asset object when used as "inline mode" #11257

dadaxr opened this issue Dec 16, 2024 · 0 comments

Comments

@dadaxr
Copy link
Contributor

dadaxr commented Dec 16, 2024

Bug description

According to the doc : https://statamic.dev/tags/asset we should be able to retrieve asset data from a path.

The doc example illustrate how to use the tag "block syntax" but when using the "inline syntax" it does not work as expected

block syntax :

{{ asset url="/img/brand/logo.png" }}
  <img src="{{ url }}" alt="{{ alt }}" />
{{ /asset }}

=> works as exptected :

but when using "inline mode", we only retrieve the path (which we already have obviously) :

{{ img = { asset url="/img/brand/logo.png" } }}

here the value of the "img" var is set to the "/img/brand/logo.png" string... and we cannot access asset data like width / ratio / alt etc.

From my point of view, we should be able to to something like that :

{{ img = { asset url="/img/brand/logo.png" } }}
img ratio is : {{ img.ratio }}
img alt is : {{ img.alt }}

How to reproduce

just use the above examples

Logs

No response

Environment

Environment
Laravel Version: 10.48.22
PHP Version: 8.2.23
Composer Version: 1.10.27
Environment: prod
Debug Mode: OFF
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / daily
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 4
Sites: 1
Stache Watcher: Disabled
Static Caching: null
Version: 5.38.0 PRO

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants