im using Zend Framework v1, I have implemented the facebook share button on my site. If I click the share button for the first time, the data is fetched (title, description and URL) but not thumbnail. However if I refresh the page, come back and press again the button, the thumbnail is being displayed.
Same thing is when i post a link via fb website - at first time there is no thumbnail but after refreshing fb site and posting link again it is being displayed.
Does anyone know how to make it working?
The meta tags seems to be ok, the fb developer tool shows no errors.
Code in the ZF Controller
$this->view->doctype('XHTML1_RDFA');
$this->view->headMeta()->appendProperty('og:title', 'some value');
$this->view->headMeta()->appendProperty('og:type', 'website');
$this->view->headMeta()->appendProperty('og:url', 'http://mydomain/file?name='.$_GET["name"]);
$this->view->headMeta()->appendProperty('og:description', 'some value');
$this->view->headMeta()->appendProperty('og:image', 'http://mydomain/up/'.$_GET["name"]);
You can either trigger a first scrape via API when you publish a new piece of content, or specify the image dimensions via OG meta tags as well.
https://developers.facebook.com/docs/sharing/best-practices#precaching:
There are two ways to avoid this and have images render on the first Like or Share action:
Pre-cache the image with the URL Debugger
Use og:image:width and og:image:height Open Graph tags
Related
Here's the scenario, when you post a link to Facebook, the scraper makes an open graph story based on og tags. However, I woudl like to know if it's possible to change the image retrieved by the scraper with one loaded by the user.
Imagine it like this, I want to post a link but the referenced site has no image, I'd like to modify the story so that its image is one I upload manually. Is that possible?
I found the answer in the API as suggested by CBroe. To clarify, I'm posting to a page, not to a profile, so I used the parameter link to, obviously, specify the link I was sharing. I also used the parameter picture to replace the thumbnail the scraper fetches with one I wanted.
This picture is a url, not an uploaded file, if someone is wondering.
So, the final array that will be sent to Facebook's API looks like this:
$data = ['message' => 'your message', 'link' => 'your-link.com', 'picture' => 'url/to/image.jpg'];
As I said, this will post a link to a page and replace the thumbnail fetched from Facebook's scraper with the image specified in the picture parameter.
Hope this helps anyone else with the same question :)
If I correct understood your question.
FB takes image from OG tag, no other way, also you cannot change this tag dynamically. I faced a long time ago with problem, that scraper could not find image on dynamically generated page. The solution was - send to FB another permament link. For example - permament link on main page site.com/module, this page for sharing to FB site.com/module/?c=123123123 (generated page by user, $c - here uniq parameter which was responsible for image in OG tag)
So - anyway if want to share page with picture - it should be contained in OG tags.
I am sharing image using to https://www.facebook.com/sharer/sharer.php?u=[some_image_link].png. When the user click the images in its facebook timeline it goes to the image path. I want to redirect the user to a particular page like http://www.example.com/page.php#/[some_image_link].
Can anyone please help?
You should be sharing a link with the OG meta tags that reflects the photo. Then you should be able to see if the request is coming from a crawler (see: https://developers.facebook.com/docs/sharing/webmasters/crawler) or a normal user and process the request accordingly.
I implemented the facebook share button on my web page, but it displays an old description text, I need to have a new text related to every article that I share, the image is updated as new.
Here is the link it's in arabic: http://achabakamagazine.com/new/articles.php?f=1&issueID=320&categoryID=26&articleID=9675&page=4
Make sure you follow Facebook sharing standards.
After that go to Facebook Url Debugger and check your each url stats.
I have developed news page in my site and my client want to post the news from my site to
facebook and when he paste news link on the facebook, ideally it should create a facebook
post preview which load snapshot of news and also it populates image [if that page contains any image] in that snapshot.
I have searched on google and I found that I need use https://developers.facebook.com/tools/debug/ and I have used that facebook tool and I found that image is not grabbed while creating snapshot.
Now please someone tell me that what I can do to get image in preview of fb post.
Here is link which is having image in his content but still is not visible in preview.
this link is having image but when I this link on fb, it is not showing up image.
As news are get created automatically, I can add any meta tag because its static solution but I am using news feed which automatically creates new pages.
So I am not expecting any static solution
The reason you are not able to see an image preview is because there is no open graph object specified on that page. For example, you need to add this :
<meta property="og:image" content="http://bevforce.com/sites/default/files/2014-07-31%2003.59.57.jpg"> in your header.
More information about open graph object on Facebook documentation.
I'm new to using the FB share buttons terminology so forgive me if I use the wrong syntax in describing this.
My site is setup to load pages based on the passed parameters in the URL (...?page=somepage&imageid=idnum).
So I have my index file which contains my head, as well as sidebar, etc. Then my main body is generated according to the passed parameter. Simple Enough.
On the homepage, the main body is a gallery of images. When they click on one of those images it takes them to a page that just displays that one image. The page is loaded with parameters of ?page=detail&image_id=1 /*or whatever the id of that image is */
So when they click on the share on FB button on those individual images page, I would like it to populate with the image that is displayed on that page. What I have done is included a php file in my head tag. The php script included gets the page info and passed parameters and then fills out the image url based on the imageid.
echo '<meta property="og:image" content="http://www.chiseledimages.com/clients/vote/'.$imgurl.'"/>';
This works in that when displaying the page source, the meta tag with og:image shows perfectly, also in that when I run it through the FB Object debugger, it gets the correct image and doesn't show me any errors. It even posts the correct image when the users shares on their wall. What is does not do, is show the correct image in the pop window after the uses presses the share button on my site. So even though the result is what I want, the problem with the user not seeing the correct image in the share pop-up, may lead them not to want to share on their wall.
Current location of site: http://www.chiseledimages.com/clients/vote/
Example of a specific pages: http://chiseledimages.com/clients/vote/?page=detail&angel_id=1
Screenshots of pop-up with wrong image, but final posted story having correct image.
How can I make the image in the pop-up match the image that is going to be shared. Thanks.
Edit: I forgot to mention and I'm sure it matters that I'm using Addthis to implement the FB share.
Check https://developers.facebook.com/docs/reference/dialogs/feed/ - look for the 'picture' parameter description
I suggest to you use this http://support.addthis.com/customer/portal/articles/1365475-attribute-based-configuration#.UwPQB6LW6So. just follow their example and you good to go.