I'm building an image library site. It will be mostly private but I'd like users to be able to directly use certain images in facebook posts by special URLs.
The URLs look plain enough: http://example.com/some/path/image.jpg although they're actually generated on demand by a script.
But when I paste that URL (the URL of the image, not a page with the image on) to Facebook it just comes up with the domain name; it does not thumbnail the image.
There are many questions about open graph meta tags - but that's to do with pages, and this question is about the case of a post with a direct image URL. I notice that it works for images from imgur, for example.
Is there something in the way the image is served, or something about the quality of the image itself that I can change to get facebook to work? Or is it just something like facebook knows to treat certain image sites a different way?
Thanks.
I think Facebook grabs the image using some kind of OpenGraph "Browser". So you need to serve it meta information depending on the User-Agent, which is
facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)
for Facebook.
So when a user browser hits your URL you serve the image, when it's facebook you serve it open-graph meta-data.
The only thing, off the top of my head, that I can think of is your favicon for that page.
Visit http://www.w3.org/2005/10/howto-favicon for information on favicons in html.
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.
If you share a definition page on Facebook from UrbanDictionary.com, the preview image is a screenshot of the definition itself. The same image appears on Google Images. The URL of the image is http://urbandictionary.com/render_definition.php?defid=[the same id as the post]
My question is, how do I make my website do that? I have a website with quotes and would like each quote to be indexed in Google Images as well as display as preview image when shared on social media. I use Wordpress, if that is relevant.
You should be able to use OpenGraph og:image to set an image URL for your page. You need to have a page that will render the image for you.
<meta content="<page_image_url>" property="og:image">
AFAIK, WordPress has a service called mShots that can take snapshots of your page for you. I couldn't find terms of service for it; but if you want to take that route, the following URL will generate a snapshot of http://example.com:
http://s.wordpress.com/mshots/v1/http://example.com/
I am working on an application that displays a form to the user, the user inputs a video URL to be displayed on their profile. The video could be coming from any possible source like Youtube, Vimeo, etc. Right now I'm using an iframe on my view.
I want the users to be able to post their videos by pasting the video URL directly from their browsers. But on most sites the url required by the iframe is different than the one displayed on the browser. For example on youtube the url displayed on the browser is https://youtube.com/watch?v=id but the URL used for embedding the video ishttps://youtube.com/embed/id . Is there a way to solve this the fast way or do I have to use regular expressions to rewrite each URL?
From Flickr's community guidelines:
"Do link back to Flickr when you post your photos elsewhere.
The Flickr service makes it possible to post images hosted on Flickr to outside web sites. However, pages on other web sites that display images hosted on flickr.com must provide a link from each photo back to its photo page on Flickr."
Our company currently allows image hotlinking for user-uploaded images. It turns out that this has been more popular than we had expected, and I would like to capitalize on this if possible.
We will be altering the guidelines to include a clause similar to Flickr's, quoted above.
As hotlinking costs us, both in terms of server load and bandwidth, we would like to get at least something out of it, other than merely a warm feeling inside.
My question:
Does Flickr "know" if a hotlinked image does not link back to its source?
Bonus: if Flickr knows, how?
You can log the Refferers on image requests and then simply fetch the page and see if you can find your domain name outside a IMG tag (or simply a link to the desired website). So it's possible, I have no idea if Flickr does this though.