Jump to content
Announcing Achievements! ×

Community

Multiple image upload - PAGES


mardiv
 Share

Recommended Posts

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

Link to comment
Share on other sites

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}}

 

Link to comment
Share on other sites

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. 🙂

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy