I need to get images by its position and I need each image resized to a concrete heigh and width.
If I want a image by its position I can do it by this code:
$_product
->getMediaGalleryImages()
->getItemByColumnValue('position', 1)
->getUrl();
//get image at position 1
And I know how to resize an image with this code:
echo $product
->helper('catalog/image')
->init($_product, 'image')
->constrainOnly(true)
->keepAspectRatio(true)
->resize(900, 400);
But this code resizes the image set as image (or thumbnail, or small_image) but I don't know how to resize the image set at certain position (for example 2).
How can I merge both codes to resize the image at a certain position?