I'm trying to get the custom posts image gallery images into bootstrap cards with carousel and so far I'm able to get the images but they are displaying one by one underneath each instead of a carousel please correct me what am I doing wrong here.
<?php
$model_images = get_field('gallery');
$image_size = 'full';
if( $model_images ): ?>
<div id="carouselExampleSlidesOnly" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item active">
<?php foreach( $model_images as $image_id ):?>
<div class="card">
<img class="card-img-top" src="<?php echo wp_get_attachment_image( $image_id, $image_size ); ?>" alt="Card image cap"/>
<div class="card-body">
<h1 class="card-title"><?php the_title();?></h1>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif;?>
</div>