We're trying to post directly to the user stream (because in our case they have already confirmed they wish to do so view a _form checkbox — so we don't want a dialog). The status posts successfully, but with no picture. To me it seems I have structured the attachment array properly, yet no dice. Any ideas?
$stutus = 'blah blah blah';
$url = 'http:/.......';
$attachment = array(
'name' => $status,
'href' => url('statuses/' . $sid, array('absolute' => TRUE)),
'media' => array(
array(
'type' => 'image',
'src' => $url,
'href' => url('statuses/' . $sid, array('absolute' => TRUE)),
)
),
);
$params = array(
'message' => $status,
'uid' => $fbu,
'action_links' => $actions,
'attachment' => $attachment,
);
fb_call_method($fb, 'stream.publish', $params);
Comments
Comment #1
Brackish Lake commentedHi, there is a $100 bounty on helping us with this. In almost every case, publish stream is not acting as we expect - and attachments aren't posting.
Comment #2
Dave Cohen commentedtry something like
right before calling stream.publish. And check out whether the image url is exactly as you expect it to be. The way you build the URL does not look like it will necessarily be an image.
Try pasting that URL into a browser that is not logged into drupal. Can it see the image? Remember that facebook will download the image and make its own copy, rather than just referring to your url on facebook.com.
Comment #3
Brackish Lake commentedHi Dave.
The image is viewable in a web browser and the array looks OK to me - but we're obviously doing something wrong. I've attached an image from our client's site.
(Strangely, sometimes it would hang (although I also had troubles logging into Fb this morning, so maybe something is funky on their end). I would get a "connection reset by peer" SSL error (we are not on SSL). I searched the issue queue and tried to comment out a couple lines in fb.module, and that seemed to improve the situation.)
But now we're where we were: everything publishes to Fb except the attachment information. The status message itself shows up on Facebook but with no image. We rely in part on an fid value from the files table - so by the time we've called stream.publish, the image is already in the /files directory. There's no funny derivative image generation going on.
Comment #4
Dave Cohen commentedFrom your image I copied the url of the image, and I get page not found. Maybe its your drupal access control or something.
Open a new browser, clear all cookies, and go to that URL. I'm sure this is what facebook sees, and that's why no image shows up.
Comment #5
Dave Cohen commentedYes, there is some slowness connecting to facebook today. What lines did you comment out? What issue are you talking about?
Comment #6
Brackish Lake commentedSorry, I should have been more specific: there was a comment you made about commenting out some CURL/SSL lines around line 450 of fb.module. Let me look into access right now...
Comment #7
Brackish Lake commentedWell something is funky. I downloaded Opera, a new browser for me, opened it open and pasted the URL - and I DO see the image. I'm certainly logged out of our website and Facebook. I double checked our image cache permissions, nothing there.
I'm going to try to turn off Boost. Maybe it's something with HTACCESS.
Comment #8
Brackish Lake commentedYep, just tried it again - same results. Doesn't post to Facebook - but is viewable in browsers where cookies are cleared and I'm signed out. This time I'll paste directly the image, straight from the Devel print.
http://www.theweddingfavor.com/sites/default/files/img_0271.jpg
Can you see that image?
Comment #9
Dave Cohen commentedYeah, that's the value you want for the image src.
Comment #10
Brackish Lake commentedAnd yet... it doesn't show up on Fb still. Am I missing a permission perhaps? Is there anything I can do to debug or get a more verbose log of what's happening? The structure I'm sending seems fine, yet it will not post any kind of attachment. I'm a bit lost.
Comment #11
Brackish Lake commentedI even hard coded that very image - just to make sure it wasn't some kind of conflict from uploading - and still no dice.
Comment #12
msathesh commented@Brackish Lake & @Dave.. I am in the same situation. Everything (title and description) works except the image attachments. Please post your solution here if you find anything. Thanks very much.
Comment #13
msathesh commented@Brackish .. Does file size matter? Your image seems to be 1.7MB. Did you try any image that's with 90 pixels width & height?
Read the facebook documentation here: Stream Attachments
I am actually trying this on my localhost and I guess facebook cannot read my localhost URL. So try putting a low res and let me know how it goes.
Comment #14
msathesh commented@Brackish & Dave .. Found the answer!!!!! The answer is images must be within 90pixels height and width.. I just tried it and works!!! Hooray!! I have been playing on with this module for a couple of days on and off and finally everything works now.. @Brackish where is my $100 bounty?? :)
Comment #15
Dave Cohen commentedhmmm I know they used to resize larger images, but everything is subject to change when it comes to facebook. For sure it will not work with a localhost url.
Comment #16
msathesh commentedYeah @Dave, we have to re-size them before posting to facebook these days it seems.. The real problem is we have to try and guess the issue and there is no way of knowing why it didn't accept the image. Yeah it doesn't work with localhost URL. So I tried it with a 90x90 image on a live server and then it worked like a charm. Thanks again for the great module..