i created a phtml file, called in the catalog_product_view.xml file (inside the head.additional reference block), where i want to preload the main product image, for Core Vitals purpose, for example:
<link rel="preload" as="image" href="<?= $block->escapeUrl($imageUrl) ?>"/>
where $imageUrl is:
$imageUrl = $block->getImageUrl();
But, the url (cached) of the product image is not retrieved. No errors, but, simply this:
<link rel="preload" as="image" href/>
So, how can i simply get in the correct way the main product image url (the main product image in the product page?)
Thanks, regards