Share generated personal image to FB with Opengraph - facebook

I'm stuck with this problem for several weeks now and will try to give a short and detailed explanation below:
Situation
Users visiting the websites and has the option to generate an image with the GD-library. So every users generated a personal image. Simple... until now. After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What's working (Yeah!)
Generating the image is working perfectly fine. Sharing something to Facebook is working also.
Problem
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image. Sometimes this is a really old image, sometimes it's a more current generated image. But never the just generated image.
And now?
As said I've already tried the fbrefresh=CAN_BE_ANYTHING. Also in de debug tool the right image isn't showing up, but this is probably because the generated image has an unique ID generated from the users cookie. So this id is only usable when the users clicks on generate and after that shares the generated image.
Is there any example on the internet that uses the same sort of strategy and is working? I've searched half the internet and didn't found it yet it's becoming more and more frustrating.

After generating the image, the user gets the option to share this image to Facebook. This is done via the OpenGraph protocol.
What exactly do you mean by the latter? Are you just uploading that image to the user’s wall/one of their albums, or are you publishing an Open Graph object with a user-generated photo attached? (Btw., user-generated photo is meant literally for OG actions – you should only do it with photos that the user has taken using f.e. their mobile phone camera while they where undertaking the action. I doubt if a GDlib-generated image fits into that description.)
Although the following code is used on sharing the image (fbrefresh=CAN_BE_ANYTHING). FB stills pulls an old image.
And by “pull” you mean what exactly, again? Do you upload the photo as an HTTP POST upload, do you upload it by URL, did you specify it as og:image for an OG object, or do you pass it as user-generated photo while publishing an action?
Now, usually the easiest way for resources referenced by a URL to get properly refreshed by the requesting client, is to attach a different value to the query string/as a GET parameter – f.e. the current unix timestamp: …/image.php?1984372634 or …/image.php?foo=bar&forcerefresh=1984372634
Since this value changes every second, it makes each of those URLs a different URL, and the requesting client absolutely has no choice but to request that resource, because he can not have it in its cache already.

Related

Facebook: Share unique image with common URL and discard the image locally. Is it kept on FB?

The problem:
I want to share a unique image each time a url is shared on Facebook. This to let users of my site share emotions and their score from having played the game they just played on the site.
So, they would share the game url, which is the same to all, but associate it with their results and an emoticon or something like that, all baked into an image created on the fly, saved on my server.
I do not want to have to keep those images after they have been shared as storage becomes cluttered.
Is this possible?
AFAIK, sharing a unique image for a url that has been shared many times before can easily be achieved via sending in the img url explicitly to the share.php along with the url to share. Is this a correct assumption?
So the question, as it stands:
Is it possible to share a unique image to the same URL over and over, and then throw away the image but it stays visible with the link on Facebook?

og:image shows only after 4 share "clicks"

I've seen this is a common issue here on stack but it seems that the answer is always dependent on the specific scenario. I'm looking for a fellow coder to give me that "AHA" moment.
Problem: Ads posted to my website do not show the og:image content when shared to facebook until the ad is shared at least 4 times
I have thought about/ tried the following things
Checking the image size to make sure it's not large (128kb) is the norm. I compress all uploads.
Giving the ad some time to marinate before sharing (perhaps the fb crawler takes a while to cache the page)
I tried using the debug crawler tool on fb to see if I could reproduce the problem and I indeed could.
I tried sharing the ad to my own page regardless of the missing image to see if the image showed up on my wall. It did not.
The image will not show up on ANY shares until someone has clicked on the share icon on an ad at least 4 times. It seems to me like it might be some latency issue on facebook's part.
What could cause og:image to only show on subsequent share clicks?
Edit
Here's a test ad.
https://www.jdmxchange.com/Classifieds/Details/6ae72690-14d8-4bab-b039-3a2d79923794
Reading https://developers.facebook.com/docs/sharing/best-practices I found this, which might be just what you're looking for:
Use og:image:width and og:image:height Open Graph tags
Using these tags will specify the image to the crawler so that it can render it immediately without having to asynchronously.
This means, if you set the width and height of your og:image with tags, the image will show straight away.
UPDATE
Actually debugging your URL shows like this URL is redirecting to another page, and then another. Which makes me suspect the Facebook crawler is not able to access the actual OG meta tags you're using.
As a random test, I would add OG metatags to that last URL and see if Facebook uses them. But the actual solution would be to use URLs which are actually reachable to FB (no credentials necessary).

Facebook's Default Image When `og:image` is Invalid

How does Facebook choose a preview image when the og:image tag is invalid? A friend and I were curious why a Facebook preview image didn't show up in the article — when we ran the URL through the Facebook debugger, it provided the following information.
Provided og:image could not be downloaded or is not big enough. Please use an image that's at least 200x200px and is accessible from Facebook. Image 'http://lostoregon.files.wordpress.com/2014/06/foodcarts.jpeg' will be used instead
Tangent: Running the debugger once appears to clear Facebook's cache, and on the next run Facebook grabbed the correct (since fixed?) image.
The one part of this I don't understand is: How did Facebook chose the http://lostoregon.files.wordpress.com/2014/06/foodcarts.jpeg image to use instead? When I look at the original page, foodcarts.jpeg isn't shown anywhere, which means either
Facebook has some secret sause for chosing from images it's seen before
Facebook picked an image that was on the page at the time, but is no longer there
Something else I'm not considering
Is this default image picking defined, deterministic behavior? If so, how does it work?
the error you describe is common enough, and the image may be all right, but Facebook probably has issues downloading it (it's too big). What happens when the image isn't good is that the get a cached representation of you page, and use the image you provided back then. If Facebook crawls many urls, and there's no image on your site, or there's no cached image, the system will pick the one you use more frequently (on all pages). At least, that's what I have seen.

Open Graph image error with complex url

I am trying to get some viral marketing with my page by alowing people to share a product with the product's image. This is a normal usecase (cliche even) however the image source is Adobe's Scene7. I have used the debugger tool facebook provides but the best they can tell me is that "The image referenced by the url of og:image tag could not be downloaded." I understand that Scene7 urls are very complex and there is a reasonable chance that this is what facebook is choking on but is there anyway around this limitation?
I cant provide an actual url (trade secrets, NDA, etc...) but the urls we are dealing with resemble http://s7d4.scene7.com/ir/render/company/product?fmt=png&resmode=sharp2&wid=350&obj=scr&show&obj=cc&decal&src=is{company/style?$text1=H&$name1=namelong&$color1=Blue}&res=150&show
If the URL isn't publicly available (ie: I open a freshly installed browser and am able to see your link) - our scraper won't be able to see that image either. I don't think there's any work around, given the details you shared, but if a thumbnail is ok from a legal point of view (a thumbnail would end up on Facebook either way), you could use public URLs for thumbnails of the images of your products.
It turns out the problem is that there is some automatic encoding occurring with the url that is not working with scene 7.

iPhone OS: Posting an image + text "story" to a user's news feed through the facebook api

So what I am trying to do is post an image that has been created by a user on an iphone into that users newsfeed.
The functionality I am having a hard time understanding if it is possible:
Can I pass a local NSURL (or URL?)(to a png file that lives in the documents folder) through a JSON string and onto Facebook?
i want to mimic the action of a user going to his/her facebook page, clicking into the textfield for their newsfeeld, uploading an image by clicking the "photos" icon and selecting an image from a local disk and uploading it. I would also like to add some text into the post optionally.
I'm just getting started with the Facebook api and it seems pretty tough right now, any help would be appreciated. code examples appreciated.
Thanks,
Nick
You'll need to use a third-party image host like YFrog or roll your own image host. Facebook requires that all media attachments (including photos) be hosted on the public web. Even though they cache the images themselves, the URL that you send to them has to have its own public URL. Many of the popular Twitter image hosts have simple REST APIs to achieve this.
You can also use Facebook itself to host the image via their photo.upload API, if you don't mind two side-effects: it will appear in the user's photo albums, and the thumbnail is likely to appear in the stream twice (once representing the addition to the photo album, and the second in the actual stream story you publish). You can't currently get around this doubling artifact, but it will give you a stable host for the uploaded image.
Just to clarify this. I was actually able to pass and image directly from the iPhone without a third party but that was posting an image to a users photo album. There are I think two methods in the fbconnect api for posting one contains an extra argument for a data argument which can be an image. I'll post more details when I'm in front of the documentation.