Support

Account

Home Forums Backend Issues (wp-admin) Choose image size in ACF-Image Field

Solved

Choose image size in ACF-Image Field

  • When i add a image inside the WYSIWYG-Editor i can choose the image-size im using (Thumbail, Medium, Large and Fullsize-Image). When i add an image through the ACF-image field i dont have these options.

    I know normally you add these values in the template-file. But i have a case when this is needed. Because normal JPG images should be integrated in a custom image size and GIF-Files should be used in the original-size (because if they are compressed, the animations are not working).

    Thank you so much for your help!

  • This is still coding that you would need to do in the template, or code that is showing the images. You should return the image array form the field. Then when you’re code is displaying to either show the full size image or the other image size based on the type of image.

  • Thank you, this helped me a lot. I know use an if statement in the template to check if it is a gif file and if then use the original image.

    <?php if (exif_imagetype($image['url']) != IMAGETYPE_GIF) { ?>
    <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    <?php } else { ?>
    <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
    <?php } ?>
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.