Explicity disable image sharing to facebook using mini_fb gem - ruby-on-rails

I use mini_fb to share text and images to facebook. My requirement is
When share text then it should share only text
When share text with image, then both text and image should be shared.
My problem is when I share text only, then a random image from the url is posted to facebook along with text. When I searched for it, I found that facebook is picking up images with og:image tag, and picking the last image and posted it.
But there is no explicit meta tag with property "og:image" in my site.
To avoid this I also put explicit meta tag with property "og:image". But the client does not need this.
Can I explicity disable image sharing to facebook, when no image is shared to facebook using 'mini_fb' gem?

it seems that at the moment it isn't possible, not because of the gem, but because of facebook.
By removing the ability to customize link metadata (i.e. headline, description, image) from all link sharing entry points on Facebook, we are eliminating a channel that has been abused to post false news.
you can see more information about this here
https://developers.facebook.com/blog/post/2017/06/27/API-Change-Log-Modifying-Link-Previews/
the way you solved it at the moment is the right way. it's better for you to set explicit the image you want to show, so there is more control about it by you.

Related

Content to share in Facebook is empty [duplicate]

I could set custom picture and caption for link. Now it is impossible for v2.9. Is there some kind of workaround without specifying og: tags.
When using Facebook Graph v2.8, you could post a link and display a custom image and not the "og:image".
This was done by adding the picture parameter to the hook.
https://graph.facebook.com/v2.9/me/feed?link=https%3A%2F%2Fwww.google.com%2F&picture=https%3A%2F%2Fi.ytimg.com%2Fvi%2FtntOCGkgt98%2Fmaxresdefault.jpg&name=test&message=this%20is%20a%20test&access_token=**********
The graph API is at 2.9 and as per the documentations this is still supposed to work Facebook API doc
However, it keeps getting overridden by the scraped image. Is anyone else experiencing this problem or have a workaround.? Facebook API Explorer
picture, name, caption, thumbnail, description are all set to be deprecated.
https://developers.facebook.com/docs/apps/changelog#v2_9_90_day_deprecations
You can go ahead and use Open Graph for posting images with custom description and title.
You can get an insight of the same from this link -> https://developers.facebook.com/docs/sharing/webmasters?hc_location=ufi

How to add Facebook meta tags to cloud hosted images?

I'm trying to share some images via the Facebook sharer url "https://www.facebook.com/sharer/sharer.php".
The images are stored in the cloud in azure blobs, so I have a url that looks like "https://myapp.blob.core.windows.net/xxxx.gif"
In order for the Facebook sharer to correctly display the image it's looking for some meta tags, like "<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>"
What would be the best way to add those tags to cloud hosted images?
Options 1
Build a redirect url that takes the id of image adds the tags then redirects to the cloud url?
Any other ideas? Would option 1 work?
You're confusing two different things. The meta tags are for web pages, where if just the link to the page is shared, Facebook can then inspect the page and create a rich representation of it in the post by relying on those tags.
If you need to share a link that happens to be to an image, then you can't use meta tags. However, you might be able to use share intents to add some context to the link. For example, if you wanted to provide a link on a web page that will allow people to share the link to the image, you could do something like:
https://www.facebook.com/dialog/feed?app_id=[appId]&link=[url]&picture=[imageUrl]&name=[imageName]&caption=[imageCaption]&description=[imageDescription]&redirect_uri=[redirectUri]
That would take the user to a dialog that would allow them to make a post to their Facebook account, with all the provided information prepopulated. The redirect_uri tells Facebook where to send them back on your site when done posting.

How to tag a friend - similar to facebook (Both imageview and normal text on the same textfield/textview)

I am working on a social networking app.
On my Textfield/Textview, I am searching my friend using "#".
Eg:#s will list out all my friends starting in s. When I choose any of these friends, I want them to be tagged (similar to facebook).
Thus in my Textfield/Textview, my friend's name will be shown on a UIImageview (similar to StackOverflow tags which is entered during asking a question).
I require both normal text as well as tagged friends on the same textfield.
Now how can I show this on my Textfield/Textview?
Please check this third party control here. It does not include image as you mentioned, but you will get some idea.
As another option, you can create UIScrollView and put whatever controls you want, that is what i will do if i need very customized text entries with images and designs.

Image not displaying when shared on Facebook

I have a small Rails application which I occasionally share on Facebook. Despite there being images on the front page, If I share the this, no thumbnails are displayed. Is there anything I need to do to make sure Facebook can pick up the images, or is there any reason why it wouldn't pick something up from my page? Link to my website
The og:image you're defining - according to the FB Debugger - http://pastonpaper.com/logo.jpg is 404ing. Once you fix that and any other errors, you should be good to go.

How to attach a site thumbnail from user submitted links in a facebook application

The Facebook application I had in mind has users submit links from sites. I would like there to be a thumbnail of the site, similar to what happens when you post/message someone a link and a thumbnail automatically shows up. Any thoughts on how to go about doing this?
The sites you link to need to have Open Graph tags (https://developers.facebook.com/docs/opengraph/) on their pages to set the default image, description and title for this to happen. If those meta tags are not set, the first image on the page will be the default along with other generic information Facebook is able to scrape from the page.
If you want to test out a few pages and see what information they have set, use Facebook's URL lint tool (https://developers.facebook.com/tools/debug). Simply copy and paste any URL in there.

Resources