Thumbnails of same size with different crop

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'.

Solutions Collecting From Web of "Thumbnails of same size with different crop"

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-

<?php
  $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