You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Hi guys,
Is there anyway to get a picture to display on Facebook when you add your website's url to it.
To get it to work you need to add <link rel="image_src" href="thumbnail_image" / > to the <head> of the document, where "thumbnail_image" is the absolute url reference to the picture you want to display.
I can use php to create the correct <link> tag within the body of the text,
<?php //for facebook
print '<link rel="image_src" href="www.jadorelamaison.co.uk/install/' . $imgurl . '" />';
?>
but when I put this in to the <head> of the document it doesn't populate $imgurl with anything.
I assume this is because $imgurl isn't defined this early in the code.
Is there any way to get the absolute url of your product image in to the <head> of your document??
Thanks for your help.
Offline
Look in [private-directory]\core\CORE\includes\multitask.php
Offline
susan2go wrote:
Look in [private-directory]\core\CORE\includes\multitask.php
Thanks for the reply but what do you mean by "Look in"? I've had a look at the php code, but I'm not sure how this helps.
It's probably gone straight over my head.
Offline
peter_dyson wrote:
susan2go wrote:
Look in [private-directory]\core\CORE\includes\multitask.php
Thanks for the reply but what do you mean by "Look in"? I've had a look at the php code, but I'm not sure how this helps.
It's probably gone straight over my head.
That's the place where the link to the .css file and .js files are located. If you want a rel link in the head that's the place to put it. You don't need to set it up with php either.
I really don't understand your variable $imgurl. There is no function defined for that as far as I can tell. I don't even understand why you need a reference in the head either. I installed a Twitter link and button the normal way in CCP7.
<p><a href="http://www.twitter.com/mycompany" target="_blank"><img src="http://twitter-badges.s3.amazonaws.com/follow_us-c.png" alt="Follow Mycompany on Twitter"/></a><p>
Offline
dh783 wrote:
Who's page are you trying to place this in, ccp's or facebooks?
John
I must have not made myself totally clear. My fault.
When you are logged into Facebook and you type a URL onto somebodys wall, Facebook will go to that URL and take an image and a description from that site. This description and image will then be displayed on that person's wall.
Currently when I paste a URL from my site, only a description comes up.
What I want to happen is that when I paste the URL of one of my products, for instance a spotted teapot, on to somebodys wall I want the image of that spotted teapot and the short description of that spotted teapot to appear on that persons wall.
I have looked on Facebook's help section and they say that to get it to work properly everytime you need to add <link rel="image_src" href="thumbnail_image" / > to the <head> of the document, where "thumbnail_image" is the absolute url reference to the picture you want to display.
susan2go wrote:
I really don't understand your variable $imgurl.
$imgurl is a variable from Store>Store Displays>Product Detail Display>Default Format. It is the variable the is used for the image that is displayed for the product on that page.
Offline
I would try putting <link rel="image_src" href="thumbnail_image" / > in multitask.php near the link to the .css file then type the url into facebook.
Offline
Thanks again for your reply, but this would mean the same image would appear in Facebook regardless of which url I pasted in.
I need a php tag that will populate the "thumbnail-image" with an absolute image url that is relevant to the page it is describing.
So that when somebody shares the url of a teapot, they get shown a picture of a teapot. And when they share the url of a vintage clock they get shown a picture of a vintage clock, not just a generic photo which would be the same for all pages.
The picture needs to be dynamic.
Offline
I did find a way to do this.
This may be a long way round, but it works.
What you need to do is add some php bits into the head section (which you will find in skin.php in the displays section) to call your variables for the image. These do get called further down in the code in the product detail section but you need them in the head section, it doesn't seem to matter if you call them twice.
You need to add this code into the <head> section
<?php
$ns = $this->globals('core.namespace');
$eol = $this->globals('core.eol');
$proddisp = $this->globals('ecom.prod_proddetail');
$xid = $proddisp['id'];
$id = $this->xhtml_encode($xid);
$imglist = $proddisp['imglg'];
if (empty($imglist)) {$imglist = 'ADD GENERIC PHOTO HERE FOR WHEN YOU ARE NOT LINKING A PRODUCT PAGE TO FACEBOOK, IT SHOULD BE KEPT IN THE BASE DIRECTORY FOR YOUR SHOP eg example.jpg';}
$imglist = $this->make_list($imglist);
$imgwidth = $this->globals('core_settings.ecom.imgsizeprodlg');
$imgtag = '';
if (empty($imgwidth)) {$imgwidth = ADD YOUR OWN PRODUCT IMAGE WIDTH HERE eg. 50;}
foreach ($imglist as $num => $img) {
$imgurl = 'media/ecom/prodlg/' . $img;
$imgtag .= '<img src="' . $imgurl . '" ';
if ($imgwidth) {$imgtag .= 'width="' . $imgwidth . '" ';}
$imgtag .= 'alt="' . $prodname . '" />';
}
?>
<?php //for facebook
print '<link rel="image_src" href="http://www.jadorelamaison.co.uk/install/'. $imgurl . '" />';
?>
Last edited by peter_dyson (11-07-2010 09:05:25)
Offline
used the code there. apparently facebook is pulling the image from joomla and not ccp so this didn't work for me as of yet.
Offline
got it to work. Used the same code and posted it in the joomla skin.php head section instead
Offline
Is there way to integrate it as a plugin ?
Offline