problem with open graph: cannot pull full size image, only thumb

Started by bbbecker, May 06, 2015, 19:00:44 PM

Previous topic - Next topic

bbbecker

hello everyone!  i am working on improving a website for the business i work at and am having trouble with Open Graph and how my images are shared on Facebook.  i am not sure if this is the right subforum to post in but it seemed right.

when someone shares a product it pulls the thumbnail image which is 250x250px, this is smaller than the minimum for a large image on facebook so all we get is a tiny thumbnail.  below is what is in the source code for a product page.  i am not sure what is generating this code but it seems to be directing Facebook to the thumbnail

<meta property="og:image" content="http://www.bbbecker.com/components/com_virtuemart/shop_image/product/resized/XXX_250x250.jpg"/>

i then did some research and found someone with a similar problem.  their solution was to add this code to the /components/com_virtuemart/views/productdetails/tmpl/default.php file

//Begin Open Graph
$og_type = 'article';
$og_url = JURI::current();
$og_image =  JRoute::_(JURI::base().$this->product->images[0]->file_url);
$og_desc = $this->product->product_s_desc;
$og_title = $this->product->product_name;

$app =& JFactory::getApplication();
$og_sitename = $app->getCfg('sitename');

$doc = JFactory::getDocument();
$doc->addCustomTag('<meta property="og:type" content="article"/>');
$doc->addCustomTag('<meta property="og:url" content="'.$og_url.'"/>');
$doc->addCustomTag('<meta property="og:site_name" content="'.$og_sitename.'"/>');
$doc->addCustomTag('<meta property="og:image" content="'.$og_image.'"/>');
$doc->addCustomTag('<meta property="og:description" content="'.$og_desc.'"/>');
$doc->addCustomTag('<meta property="og:title" content="'.$og_title.'"/>');
$doc->addCustomTag('<meta property="fb:app_id" content="(MY APP ID #)"/>');
//End Open Graph


it is my understanding that the "file_url" location is the full image, nnot the thumb.  the og:image tag in the source has not changed at all tho :(

i have also tried using a plugin i already am using called JFB Connect.  i was told by their support to add {SCOpenGraph image=FULL_PATH_TO_IMAGE}  to the template...which i am assuming means the product page template.

here is a link to their virtuemart/opengraph page: https://www.sourcecoast.com/jfbconnect/docs/third-party-integration/facebook-integration-for-virtuemart

I added the code below at the BOTTOM of the default.php template file. still nothing.  i do not really know PHP, just cobbling things together.
{SCOpenGraph image=<?php JRoute::_(JURI::base().$this->product->images[0]->file_url?>}

if anyone has any insight on how to pull full size images using the og:image tag i would be in your debt  :-[

GJC Web Design

the snippet

<meta property="og:image" content="'.JURI::base().$this->product->images[0]->file_url.'" />

is definitely correct (you don't need jroute )

gives on test e.g. http://localhost/virtuemart/images/stories/virtuemart/product/classic_hat.jpg

are you sure your dumping the FB cache by going to the FB tool and reloading the og's?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

bbbecker

thanks for the reply!  i have been going to https://developers.facebook.com/tools/debug/og/object/ and rescraping the URL after every change to verify that it still isnt working.

no matter what i do the og:image tag in the source never changes and the debugger always pulls the thumbnail:
<meta property="og:image" content="http://www.bbbecker.com/components/com_virtuemart/shop_image/product/resized/XXXX_250x250.jpg"/>

in the debugger i get this message even though the og:image is defined:
Quoteog:image was not defined, could not be downloaded or was not big enough. Please define a chosen image using the og:image metatag, and use an image that's at least 200x200px and is accessible from Facebook. Image 'http://www.bbbecker.com/images/stories/virtuemart/product/resized/magictoolbox_cache/c9870ad6629eeac0d043eb471f523256/2/6/265/thumb500x500/2342303053/831-1997.jpg'; will be used instead.

GJC Web Design

FB isn't the problem  - u need to find why <meta property="og:image" content="'.JURI::base().$this->product->images[0]->file_url.'" />

gives you http://www.bbbecker.com/components/com_virtuemart/shop_image/product/resized/XXXX_250x250.jpg

it shouldn't - on a std. VM it gives

http://www.bbbecker.com/components/com_virtuemart/shop_image/product/XXXX.jpg

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

bbbecker

yeah its definitely not facebooks problem, just getting quite irritating trying to get this to work.

so apparently JFBConnect will try and disable other code that makes Open Graph tags.  their support says i have to use the {SCOpenGraph image= XXXX } code to change the image tag.  apparently it goes anywhere in the page file (which i assume is the default.php in productdetails).

from what i understand this code should work fine... i guess i have to harass JFBC some more  :P
{SCOpenGraph image=<?php JURI::base().$this->product->images[0]->file_url ?>}

i'm using virtuemart 2 btw

Studio 42

Perhaps you use a very old beta vm2.
The path was changed more then 3 years ago from
components/com_virtuemart/shop_image/product/XXXX.jpg
to
images/stories/virtuemart/product/XXXX.jpg

I think it's better to do the effort to upgrade to vm 2.6. if you use joomla 2.5