Trying to output an asset's details and url
is just blank?
Perhaps alt
text, even width
and height
work, but not url
?
You might have something like this:
my_asset_field: - path/to/image.jpg
{{ my_asset_field }} <img src="{{ url }}" alt="{{ alt }}" width="{{ width }}" height="{{ height }}" />{{ /my_asset_field }}
@foreach ($my_asset_field as $asset) <img src="{{ $asset->url }}" alt="{{ $asset->alt }}" width="{{ $asset->width }}" height="{{ $asset->height }}" />@endforeach
<img src="" alt="An image" width="100" height="150" />
That'll be because your Asset Container's disk does not have a url
configured.
# content/assets/my_container.yamldisk: assets
// config/filesystems.php'disks' => [ 'assets' => [ 'driver' => 'local', 'root' => public_path('assets'), 'visibility' => 'public', 'url' => '/assets', // 👈 you're missing this ],]
Asset containers using url-less disks are considered "private" and will intentionally not output URLs.