Wordpress get/insert post attachments at custom size linked to custom size

<?php
// To insert custom loop of post attachments as images (at core or custom size) linked not to full size image but custom-configured (or core) size.

$postID = $post->ID;
//print_r($product_meta);

// (thumbnail, medium, large or full) or a 2-item array
// representing width and height in pixels, e.g. array(32,32)
// OR the custom config'd name of image size
$image_size = 'prods-large'; // the image size to be shown initially (smaller version)
$image_size_lg = 'large'; // the image size to link to (large version)

$images = get_children(array(
'post_parent' => $postID,
'post_type' => 'attachment',
'numberposts' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
//'exclude' => get_post_thumbnail_id(), -- uncomment to exclude post thumbnail
'post_mime_type' => 'image',
)
);

//print_r($images);
if($images) {

echo '<div class="prod-imgs">';

foreach( $images as $image ) {

$attachment_id = $image->ID;

// get the 'large' size image's URL
$image_attributes = wp_get_attachment_image_src( $attachment_id, 'large' ); // returns an array - [0] is the URL of the image 'large' size
$largeSizeURL = $image_attributes[0];

echo '<a class="attachment-' . $attachment_id . ' popup-with-zoom-anim img-link" href="' . $largeSizeURL . '">';
echo wp_get_attachment_image($attachment_id, $image_size);
echo '</a>';

}
echo '</div>';
}
?>


Learn More :