0
Welcome Guest! Login
0 items Join Now

Particle's image picker can't translate "gantry-media://" to real URI

    • shenk's Avatar
    • shenk
    • Hero Rocketeer
    • Posts: 424
    • Thanks: 11

    Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • I am trying to build a custom logo particle, here is what I have encountered:



      twig:
          logo:
            type: input.imagepicker

      yaml:

      <div id="logo"><img src="{{particle.logo}}"></div>



      backend:
      This image is hidden for guests.
      Please log in or register to see it.


      frontend:
      This image is hidden for guests.
      Please log in or register to see it.


      I think this is a bug
    • Last Edit: 9 years 8 months ago by shenk.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13484
    • Web Designer/Developer

    Re: Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • You got the captions wrong above... and it's your TWIG that is wrong.

      Change this:
      <div id="logo"><img src="{{particle.logo}}"></div>

      to this:
      <div id="logo"><img src="{{ url(particle.logo)|e }}"></div>

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • shenk's Avatar
    • shenk
    • Hero Rocketeer
    • Posts: 424
    • Thanks: 11

    Re: Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • Thanks for the information, it works. However, I have to point out that this "url()" syntax is not mentioned in the documentation: docs.gantry.org/gantry5/advanced/creating-a-new-particle . So how did you know it and where can I see a more detailed explanations about these things?
    • Last Edit: 9 years 8 months ago by shenk.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13484
    • Web Designer/Developer

    Re: Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • Our documentation does link you to the complete set of TWIG documentation here several times - http://twig.sensiolabs.org/documentation - there's no point in us copying that or maintaining it.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • shenk's Avatar
    • shenk
    • Hero Rocketeer
    • Posts: 424
    • Thanks: 11

    Re: Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • Are you sure this function `url()`, which can translate 'gantry-media' to real URL, is from twig? It is weird if twig would have some function capable of recognizing gantry, unless it has been modified. If so, how can we normal users get to know the usage of things like "url()" from twig's documentation??
      I have done a search in twig API, and the closest one I can find is "url_encode", which is a filter but not a function. I even google "url()" site:http://twig.sensiolabs.org/, it returns nothing relative.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13484
    • Web Designer/Developer

    Re: Particle's image picker can't translate "gantry-media://" to real URI

    Posted 9 years 8 months ago
    • Did you try what I said? Twig is running as part of and in conjunction with Gantry. Just have a look at existing particles provided with the template you will see that they do the same thing as I told you.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.

Time to create page: 0.071 seconds