Support

Account

Home Forums Add-ons Gallery Field Size of Gallery and single image preview

Solving

Size of Gallery and single image preview

  • Hello,

    i have a field create with ACF Galley and i neet to put inside 10 image. I need to see this on sidebar.

    So i’ve create a PHP field with this code

    <?php 
    
    $images = get_field('gallery');
    
    if( $images ): ?>
        <ul>
            <?php foreach( $images as $image ): ?>
                <li>
                    <a href="<?php echo $image['url']; ?>">
                         <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
                    </a>
                    <p><?php echo $image['caption']; ?></p>
                </li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>

    But i see the image withe size that is more big for me and not display inline but one picutre on one line.

    I try some code but i don’t know how can i resize the image size (only for image on this field) and display avery image inline. Thanks

  • Hi @serviceweb

    If you see different thumbnail sizes, you need to enable the “Crop thumbnail to exact dimensions (normally thumbnails are proportional)” option on “wp-admin > Settings > Media”. After that, you need to regenerate the thumbnail again using a plugin like this one: https://wordpress.org/plugins/regenerate-thumbnails/.

    I hope this helps.

  • Hello…no i’ve alredy setting the crop thumbnail” but i have alredy the problem. I have one photo in one line. I can’t setting two photo in the same line 🙁

  • Hi @serviceweb

    If you need to make the images inline, please take a look at this page: http://www.w3schools.com/css/css_display_visibility.asp.

    Please learn more about CSS here: http://www.w3schools.com/css/.

    Hope this helps.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Size of Gallery and single image preview’ is closed to new replies.