Support » Developing with WordPress » add_image_size problem

  • Resolved luisa

    (@luisavilhena)


    Hello,

    I created this function:

    function mytheme_add_custom_image_sizes() {
         // Add "vertical" image
        add_image_size( 'vertical-c', 800, 1000, true);
        add_image_size( 'vertical-b', 800, 1000, true);
    }
    add_action('after_setup_theme', 'mytheme_add_custom_image_sizes' );

    With the same width and height the image vertical-b is showing a square image and vertical-c isn’t cropped.

    and the setup for midia is:
    Thumbnail image with a 150×150 resolution.
    Medium image with a 800×1000 resolution.
    Large image with a 1024×1024 resolution.`

    How can I crop a vertical image?

Viewing 3 replies - 1 through 3 (of 3 total)
  • What size is the original image? Note that images can only be cropped or resized to smaller sized. If a particular dimension of an original image is smaller than the registered image size, it will keep its original size in that dimension, because it can’t be cropped down to a bigger size.

    Moderator bcworkz

    (@bcworkz)

    Whatever behavior you get, it should be the same for both sizes since the parameters are identical. Assuming you uploaded an image larger than 800×1000; and you don’t get images cropped to 800×1000, then your theme or a plugin is likely interfering with the logic used to size images.

    Thread Starter luisa

    (@luisavilhena)

    Thank you for your help.

    The original size is bigger than the new dimension.

    I resolved with Degenerate Thumbnails plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.