Open Graph Protocol Image Too Small Magento 2












0














I notice the default code for the image open graph protocol generates the smallest image available.



<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />


How do I get the image that's shown on the product page (which is actually over 1000px)?



I am trying to upload products to a Facebook catalogue via pixel (it uses Open Graph data). And I can only presume this is the reason why it's not working correctly.










share|improve this question















This question has an open bounty worth +50
reputation from YorkieMagento ending in 14 hours.


This question has not received enough attention.


The current functionality seems to call a small image - and to feed this data into Facebook it needs to be a minimum of 250px x 250px but ideally larger.
















  • did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
    – Kavitha mano
    Jan 2 at 9:20


















0














I notice the default code for the image open graph protocol generates the smallest image available.



<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />


How do I get the image that's shown on the product page (which is actually over 1000px)?



I am trying to upload products to a Facebook catalogue via pixel (it uses Open Graph data). And I can only presume this is the reason why it's not working correctly.










share|improve this question















This question has an open bounty worth +50
reputation from YorkieMagento ending in 14 hours.


This question has not received enough attention.


The current functionality seems to call a small image - and to feed this data into Facebook it needs to be a minimum of 250px x 250px but ideally larger.
















  • did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
    – Kavitha mano
    Jan 2 at 9:20
















0












0








0







I notice the default code for the image open graph protocol generates the smallest image available.



<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />


How do I get the image that's shown on the product page (which is actually over 1000px)?



I am trying to upload products to a Facebook catalogue via pixel (it uses Open Graph data). And I can only presume this is the reason why it's not working correctly.










share|improve this question













I notice the default code for the image open graph protocol generates the smallest image available.



<meta property="og:image" content="<?= $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />


How do I get the image that's shown on the product page (which is actually over 1000px)?



I am trying to upload products to a Facebook catalogue via pixel (it uses Open Graph data). And I can only presume this is the reason why it's not working correctly.







magento2 product-images open-graph






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 10 '18 at 6:48









YorkieMagento

44231439




44231439






This question has an open bounty worth +50
reputation from YorkieMagento ending in 14 hours.


This question has not received enough attention.


The current functionality seems to call a small image - and to feed this data into Facebook it needs to be a minimum of 250px x 250px but ideally larger.








This question has an open bounty worth +50
reputation from YorkieMagento ending in 14 hours.


This question has not received enough attention.


The current functionality seems to call a small image - and to feed this data into Facebook it needs to be a minimum of 250px x 250px but ideally larger.














  • did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
    – Kavitha mano
    Jan 2 at 9:20




















  • did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
    – Kavitha mano
    Jan 2 at 9:20


















did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
– Kavitha mano
Jan 2 at 9:20






did u try to add these parameters, <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />
– Kavitha mano
Jan 2 at 9:20












1 Answer
1






active

oldest

votes


















2














If you are using a custom theme, you can override Magento_Catalog::product/view/opengraph/general.phtml by the following steps:




  1. Create the a template file like bellow struct:



app/design/frontend/YourTheme/themename/Magento_Catalog/templates/product/view/opengraph/general.phtml





  1. Change this:


<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />



to



<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_page_image_large')->getImageUrl()); ?>" />



Now, your open graph protocol image will be changed to the large image. I tried this and it worked fine for me






share|improve this answer























  • Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
    – YorkieMagento
    Jan 3 at 16:43










  • It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
    – Babon
    2 days ago













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f252989%2fopen-graph-protocol-image-too-small-magento-2%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














If you are using a custom theme, you can override Magento_Catalog::product/view/opengraph/general.phtml by the following steps:




  1. Create the a template file like bellow struct:



app/design/frontend/YourTheme/themename/Magento_Catalog/templates/product/view/opengraph/general.phtml





  1. Change this:


<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />



to



<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_page_image_large')->getImageUrl()); ?>" />



Now, your open graph protocol image will be changed to the large image. I tried this and it worked fine for me






share|improve this answer























  • Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
    – YorkieMagento
    Jan 3 at 16:43










  • It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
    – Babon
    2 days ago


















2














If you are using a custom theme, you can override Magento_Catalog::product/view/opengraph/general.phtml by the following steps:




  1. Create the a template file like bellow struct:



app/design/frontend/YourTheme/themename/Magento_Catalog/templates/product/view/opengraph/general.phtml





  1. Change this:


<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />



to



<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_page_image_large')->getImageUrl()); ?>" />



Now, your open graph protocol image will be changed to the large image. I tried this and it worked fine for me






share|improve this answer























  • Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
    – YorkieMagento
    Jan 3 at 16:43










  • It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
    – Babon
    2 days ago
















2












2








2






If you are using a custom theme, you can override Magento_Catalog::product/view/opengraph/general.phtml by the following steps:




  1. Create the a template file like bellow struct:



app/design/frontend/YourTheme/themename/Magento_Catalog/templates/product/view/opengraph/general.phtml





  1. Change this:


<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />



to



<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_page_image_large')->getImageUrl()); ?>" />



Now, your open graph protocol image will be changed to the large image. I tried this and it worked fine for me






share|improve this answer














If you are using a custom theme, you can override Magento_Catalog::product/view/opengraph/general.phtml by the following steps:




  1. Create the a template file like bellow struct:



app/design/frontend/YourTheme/themename/Magento_Catalog/templates/product/view/opengraph/general.phtml





  1. Change this:


<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()); ?>" />



to



<meta property="og:image" content="<?php echo $block->escapeUrl($block->getImage($block->getProduct(), 'product_page_image_large')->getImageUrl()); ?>" />



Now, your open graph protocol image will be changed to the large image. I tried this and it worked fine for me







share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday









Teja Bhagavan Kollepara

2,93841847




2,93841847










answered Jan 2 at 8:32









Babon

6748




6748












  • Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
    – YorkieMagento
    Jan 3 at 16:43










  • It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
    – Babon
    2 days ago




















  • Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
    – YorkieMagento
    Jan 3 at 16:43










  • It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
    – Babon
    2 days ago


















Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
– YorkieMagento
Jan 3 at 16:43




Not working for me in 2.2.6 Lee. Gives me the exact same result as the original piece of code...
– YorkieMagento
Jan 3 at 16:43












It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
– Babon
2 days ago






It works for me on 2.2.6. Before: imgur.com/a/qplfMpg After: imgur.com/a/4WHidAi . Please make sure you cleaned block_html cache and your custom theme is activating
– Babon
2 days ago




















draft saved

draft discarded




















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f252989%2fopen-graph-protocol-image-too-small-magento-2%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

An IMO inspired problem

Management

Has there ever been an instance of an active nuclear power plant within or near a war zone?