Skip to content

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

@dadaxr

Description

@dadaxr

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions