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

Leave a Comment