I am showing the images and getting all that images from database. I'm showing two images on one row, in which the first image is big in size while the second one is small in size. Now the 2nd row again have the two images but this time first image should be small and the second should be large. 

I am using PHP and used 'foreach' for loop to get all the images form the database. So how can I do this ? here is a sample piece of code:

```
 <? foreach ($model->images as $img) { ?>
     <div class="big_img">
         <div class='list_img' style="background-image: url('<?= $img->url ? : UPLOAD_URL.'images/'.$img->image1?>')">
     </div>

     <div class="small_img">
         <div class='list_img' style="background-image: url('<?= $img->url ? : UPLOAD_URL.'images/'.$img->image2?>')">
     </div>
 <? } ?>

```