Find smallest upload height in foreach loop

3 posts by 3 authors in: Forums > CMS Builder
Last Post: December 4, 2017   (RSS)

By mizrahi - December 4, 2017 - edited: December 4, 2017

Sounds like this could be a job for flexbox, which can do this via CSS on the fly. No need to set a max-height. 

By Dave - December 4, 2017

Hi Zicky, 

If you want to do it with PHP, try this: 

<?php foreach ($projectsRecords as $record): ?>
      <?php
        $thumb4Heights = array_column($record['before_after_photos'], 'thumbHeight4');
        if ($thumb4Heights) { $thumb4MinHeight = min($thumb4Heights); }
        else                { $thumb4MinHeight = 0; }
      ?>
      <?php foreach ($record['before_after_photos'] as $index => $upload): ?>

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com