I am trying to add product image in the sales order email template with overriding in the path
/app/design/frontend/vendor/Mytheme/Magento_Sales/templates/email/items/order/default.phtml.
Code Written:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$_product = $objectManager->get('Magento\Catalog\Model\Product')->load($_item->getProductId());
$imageHelper = $objectManager->get('\Magento\Catalog\Helper\Image');
$image_url = $imageHelper->init($_product, 'product_thumbnail_image')->setImageFile($_product->getFile())->resize(100, 100)->getUrl();?>
<img src="<?php echo $image_url;?>"/>
Unfortunately, I am getting this in the mail. originals source is overridden by src which is getting generated. Not able to get an image in the mail.
Inspected element:
<img data-imagetype="External" **src="/actions/ei?u=http%3A%2F%2F...%3A1080%2FQPwebstore%2Fpub%2Fmedia%2Fcatalog%2Fproduct%2Fb%2Fa%2Fballpen_with_stylus1.jpg&d=2019-04-16T13%3A15%3A46.063Z"**
**originalsrc="http://......./pub/media/catalog/product/b/a/ballpen_with_stylus1.jpg"** data-connectorsauthtoken="1" data-imageproxyendpoint="/actions/ei" data-imageproxyid="" class="x_product-image-photo" width="200" height="200" alt="Stylus Pen" style="border:0; height:auto; line-height:100%; outline:none; text-decoration:none">
Kindly help me to resolve this issue..