Home › Forums › General Issues › Custom Image Sizes › Reply To: Custom Image Sizes
I’m attempting to get this to work, but without success. I think I just have some of the code wrong from Jonathan’s example.
My functions.php:
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'profile', 650, 650, true );
}
My template file:
<?php $image = get_field('test_image'); ?>
<?php if($image): //dont output an empty image tag ?>
<img src="<?php echo $image['profile']['customsize']; ?>" width="<?php echo $image['profile']['customsize-width']; ?>" height="<?php echo $image['profile']['customsize-height']; ?>" alt="<?php echo $image['caption']; ?>" />
<?php endif; ?>
Any help appreciated! To clarify the above, but ACF image field is set to object, and it is called test_image. Thanks.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.