I got this method in my RelatedProduct class that gets related product image URL
public function getProductImageUrl($product)
{
return $this->_storeManager->getStore()
->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . 'catalog/product' . $product->getImage();
}
and when I use it in my template
<img src=" <?= $product->getProductImageUrl($relatedProduct) ?> ">
the image is too large, it takes up whole screen.
How can I set the size of the image to base image size, preferably without having to add css styling for it? Can I do it in some .xml file?