Jump to content

Recommended Posts

Posted

Hi,

can anyone help me please how to setup custom field for multiple image upload and how to display this field in the record with thumbnail and full size image?

If I use this code in the record, its mixed up and pictures are doubled.

  {{$images = $record->customFieldDisplayByKey('galerie', 'raw') and $thumbs = $record->customFieldDisplayByKey('galerie', 'thumbs');}}
  {{foreach $images as $image_url}}
  {{foreach $thumbs as $image_thumbs}}
    <a href='{$image_url}' data-ipsLightbox><img src='{$image_thumbs}'/></a>	
  {{endforeach}}
  {{endforeach}}

 

I have uploaded only two pictures

697027465_Vstiek.thumb.JPG.59502a7dfbf719ee3053a233d4d0f04e.JPG

 

 

 

 

 

Thanks

Posted

You have a foreach loop nested inside the foreach loop - there are two images and two thumbs, so you're going to end up with 4 images in that case. A better loop in your case is probably

  {{$images = $record->customFieldDisplayByKey('galerie', 'raw') and $thumbs = $record->customFieldDisplayByKey('galerie', 'thumbs');}}
  {{foreach $images as $k => $image_url}}
    <a href='{$image_url}' data-ipsLightbox><img src='{$thumbs[$k]}'/></a>	
  {{endforeach}}

 

Posted

thank you very much its better, but click on the thumb is opening other image, not the same.

  • If I have Two images. First open second and other way.
  • If I have three images: same as above, and third is working
  • If I have four images: first open third, second is working, third open forth , forth open first. 🙂

 

Posted

It would seem to indicate that the 'raw' and 'thumbs' calls are not returning the images in the same order. I would have to debug and test myself to give you a much better answer I'm afraid, but hopefully the suggestion above can guide you on the right track at least.

Posted
1 minute ago, bfarber said:

It would seem to indicate that the 'raw' and 'thumbs' calls are not returning the images in the same order. 

Yep. We’ve reported this in the past. @Matt wanted to look into it. The full image uses the order of the upload. The thumbs do not. 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...