I solved it!
Hello! I have tried to find a way to add the width and height to the images in a ACF gallery. But it doesn´t call any values of the chosen size medium-height.
Everything except that works. The Alt text is rendered/ displayed.
What I´m I missing?
I missed to define $size.
$size = ‘medium-height’;
<?php
$images = get_field('artist_galleri');
if( $images ): ?>
<ul class="image-galleri">
<?php foreach( $images as $image ): ?>
<div id="artist-galleri">
<li>
<a href="<?php echo $image['url']; ?>">
<div class="maxh"><img src="<?php echo $image['sizes']['medium-height']; ?>" width="<?php echo $image['sizes'][ $size . '-width' ]; ?>" height="<?php echo $image['sizes'][ $size . '-height' ]; ?>" alt="<?php echo $image['alt']; ?>" ></div>
</a>
</li>
</div>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Thanks for posting the solution to your problem. This will probably help others.
~JH