Cms: Glide Tag Pair doesn't work

Created on 30 Jan 2020  路  21Comments  路  Source: statamic/cms

Hello,

Getting this error when using glide pair tag:

Facade\Ignition\Exceptions\ViewException
Call to a member function disk() on null

I'm using https://github.com/statamic/starter-kit-cool-writings.
I've just changed the content of the first article to add an image:

1996-11-18.dance.md

image:
  - content/reebok-pumps.jpg

As explained here: https://statamic.dev/tags/glide#tag-pair
I then add in the template:

show.antlers.html

{{ glide:image width="600" }}
    <img src="{{ url }}" width="{{ width }}" height="{{ height }}">
{{ /glide:image }}

Thanks

not a bug

Most helpful comment

Supported in the next release.

All 21 comments

Did you add the image field to your Blueprint and choose the proper asset container?

Ya I did had an asset field in the article blueprint:

-
        handle: image
        field:
          container: assets
          mode: grid
          restrict: false
          allow_uploads: true
          type: assets
          localizable: false
          listable: hidden
          display: Image

And this is working in the article template:

{{ image }}
        <img src="{{ glide:url width='400' }}">
{{ /image }}

Ah yeah cuz it's an array. Add max_files: 1 if you only want to have 1 image and it'll work fine, otherwise do the loop. You're good to go! 馃憤

I'm having the same error with an array @jackmcdade

If you resave the entry it'll be saved as a string and will snap into place.

I've select 3 images in the control panel and saved, now it looks like this

image:
  - content/lagoa.jpg
  - content/reebok-pumps.jpg
  - content/surge.jpg

Still getting:

Facade\Ignition\Exceptions\ViewException
Call to a member function disk() on null

You said it was working? Are you doing this?

{{ image }}
    {{ glide:url width='400' }}
        <img src="{{ url }}">
    {{ /glide:url }}
{{ /image }}

You read a bit too fast 馃槃

I said this is working:

{{ image }}
        <img src="{{ glide:url width='400' }}">
{{ /image }}

but this it not:

{{ glide:image width="600" }}
    <img src="{{ url }}" width="{{ width }}" height="{{ height }}">
{{ /glide:image }}

So maybe the doc is wrong? Has I said I'm following this exemple: https://statamic.dev/tags/glide#tag-pair

I think the confusion is probably that the glide tag pair doesn't loop over multiple images. It just exposes variables _about one image_ between the tag pair.

You still need to loop over image.

The docs are for a single asset, not an array of assets. Follow this example here: https://github.com/statamic/cms/issues/1280#issuecomment-580457651

Saying that, there's not really any reason we can't make it loop through multiple images.

Hum ok, I understood that Glide tag pair was a loop.

Tough it was an abstraction of a loop+glideTag to resize an array of images.

Nope, nor is that anywhere in the docs. Sorry for any confusion! But like Jason said, we could add support for that. It's just not how it works. You need to pass single images or URLs into it right now.

No worries now it's clear and it's perfectly working.
I'm just wondering if the doc could be improved for other.
But it's maybe just me that miss understood.

Ya as Jason said it could be nice to support looping trough an array of image with a glide tag.
Shorter version is always better nope? :)
Thank you for your help ! 馃檹

Supported in the next release.

Wow that was fast 馃殌 !
Thanks Jason

Hey @jasonvarga,
I'm having this exact same error again just after upgrading to v3.0.0-beta.32
This release might have introduced a regression has I didn't change anything on my side.

Should be fixed in beta 33 which I'm releasing in a couple of minutes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sauerbraten picture sauerbraten  路  3Comments

jelleroorda picture jelleroorda  路  3Comments

wm-simon picture wm-simon  路  3Comments

sandervanh picture sandervanh  路  4Comments

jimblue picture jimblue  路  3Comments