Support

Account

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.