0

I want to get the image detail by its ID rather than the URL. Here is my code that is not working.

List page {exp:channel:entries channel="gallery"}

{gallery_images}
 <li>  
<a href="/gallery/detail/{image:id}/"><img src="{image:url:medium}" class="img" alt="{image:title}"></a>
 </li>
{/gallery_images}  

{/exp:channel:entries}

Detailed Page

{exp:channel:entries channel="gallery"} {exp:channel_images:images segment_3="{image:id}"} {/exp:channel_images:images}

Thanks

1 Answer 1

0

Here is how you would do the detail page:

{exp:channel_images:images image_id="{segment_3}"}
{image:url}
{/exp:channel_images:images}

Another choice if you have a variable called image already is to do this:

{exp:channel_images:images image_id="{segment_3}" prefix="ci"}
{ci:url}
{/exp:channel_images:images}

Brad

2
  • Thanks. It is now working. If i wrapped the Channel entry tag around it, it stops working. Any workaround for this? Jul 17, 2015 at 1:00
  • Possibly you have a field named "image" or something? This could cause variable collision. Giving an alternative in my answer.
    – Parscale
    Jul 17, 2015 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.