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

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

  • Thanks. It is now working. If i wrapped the Channel entry tag around it, it stops working. Any workaround for this? – user2064047 Jul 17 '15 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 '15 at 13:01

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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