• Resolved spiff79

    (@spiff79)


    Has anyone managed to get “crop position” to work with “add_image_size”? I would like to crop an image from the top, but it always crops from the center (default).

    I have followed the example in the Codex: https://codex.www.ads-software.com/Function_Reference/add_image_size#Crop_Mode

    Code in functions.php:

    if ( function_exists( 'add_theme_support' ) ) {
      add_theme_support( 'post-thumbnails' );
    }
    add_image_size( 'portrait', 200, 300, true );
    add_image_size( 'portrait-square', 250, 250, array( 'center', 'top' ));

    Code in page.php:
    <? the_post_thumbnail('portrait-square'); ?>

    I’ve tried this on two different wordpress installs (both local and ftp), and have regenerated the thumbnails.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Crop position does not work with "add_image_size"’ is closed to new replies.