Is there any way to generate thumbnails of the same dimensions, but with a different crop?

I want to do something like:

add_image_size( 'thumbnail_top', 360 , 180 , array ('center', 'top') ); 
add_image_size( 'thumbnail_middle', 360 , 180 , array ('center', 'center') ); 
add_image_size( 'thumbnail_bottom', 360 , 180 , array ('center', 'bottom') );

but there is nothing in the filename to define the crop, so the thumbnail file always gets overwritten with the last in the list of the same size, therefore in this example, 'thumbnail_top' will always display as 'thumbnail_bottom'.

  • You are correct. Currently, the last image size with the same dimensions will be the one saved. Commented May 12, 2015 at 19:16
  • Thanks, @NathanPowell - any strategies for a workaround? Only obvious one I can think of is to increment dimensions by a pixel for each crop, but this has other implications such as potentially incorrectly-sized images displayed to user. Commented May 13, 2015 at 8:43
  • I thought of that as a workaround as well. Honestly I would need to know the goal for doing this to begin with. Commented May 13, 2015 at 18:27
  • User uploads a single featured image which is displayed in the post template. A "letterbox" cropped version appears on the archive page. A drop-down menu has been implemented as a meta-box to select whether crop is taken from top, middle or bottom (depending on composition of image). Aim is to minimise requirements for external editing of images and need for uploading multiple images. Commented May 14, 2015 at 8:34
  • I think there was a hook to change the naming. Currently on the go, might be able to look into it later.
    – kraftner
    Commented Mar 24, 2017 at 17:49

1 Answer 1


You can define your own cropping sizes but you can create a function that accepts image size + image position and then load your images accordingly.

For example-

  $size = 'medium';

  $pos = array(
    'top' => '100',
    'left' => '100'

  function load_image_with_pos( $img_id, $size, $pos ) {
    $img_src = wp_get_attachment_image_src( $img_id, $size );
    $new_img = array(
      'url' => $img_src,
      'size' => $size,
      'position' => $pos

    return $new_img;

I hope it helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.