Support

Account

Home Forums Add-ons Gallery Field open exact image size with fancybox/gallery

Solved

open exact image size with fancybox/gallery

  • this is my ACF gallery code to open gallery images with fancybox:

    <?php $images = get_sub_field('bild'); if( $images ): ?> 
    <?php foreach( $images as $image ): ?>
    <a rel="example_group" href="<?php echo $image['url']; ?>" title="<?php echo $image['title']; ?>">
    <img src="<?php echo $image['sizes']['thumb-180']; ?>" />
    </a>
    <?php endforeach; ?>                        
    <?php endif; ?>

    a click on a thumbnail opens the uploaded image, but i need to specify an exact images size because some images are about 5MB … so i want it to open a image size that is specified in my functions.php:

    add_image_size( 'gallery-600', 600, 420, true );

    it works with the thumbnail but not with the gallery image i want to open… . any idea?

  • okay now i figured out i just had to replace the “$url” so it has to look like:

    <?php echo $image['sizes']['thumb-180']; ?>

    😀 it was so near i haven’t seen it. i thought it’s too easy 😛

  • Don’t know if this is hijacking the thread, actually. I use a plugin called ‘Additional image sizes [zui]’ (https://wordpress.org/plugins/additional-image-sizes-zui/) that enables me to add and remove image sizes through the WordPress backend plus lets me create or delete the corresponding cropped versions of my media. However, once I use one of the sizes declared via the plugin and insert it as the size to be used by the gallery addon, it does not put anything out. Once I add the size to my functions.php manually it works flawlessly.

    Is there a way I can use both? I know it’s a different plugin that’s in place here, but I sincerely hope there is a workaround for these circumstances, since the sizes do work with other plugins so far.

    Best

    physalis

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

The topic ‘open exact image size with fancybox/gallery’ is closed to new replies.