Posted Image size is changing while using facebook graph api - android

I posted message and image to facebook wall using graph api.Here is the code I used
if(i==1){
String res= UrltoValue.getValuefromUrl("https://graph.facebook.com/"+Login.facebookid+"/feed?access_token="+accesstoken+"&method="+"post"+"&message="+strFullMessage.replaceAll(" ", "%20")+"&source="+imageUrl);
Log.e("post response",res);
if(res.contains("id")){
Toast.makeText(getApplicationContext(), "successfully posted", Toast.LENGTH_SHORT).show();
}
Both the message and image are posted successfully,but the image size is taking as thumbnail.I used both "source" and "picture" parameters,but the result is same.
I am getting these images from my local database.
I checked the image size of that Url,it is 240*320 size,but it is displaying in small size in my facebook.

Posting to the wall using graph api will always result in the image size chosen by facebook.
https://developers.facebook.com/docs/reference/api/post/
This is to maintain uniformity in the feed. You can post as big an image as you want but it will be resized while being displayed in the feed. The user can view a bigger version when he clicks on it though.
Image sizes can be set while querying them from facebook. See:
https://developers.facebook.com/docs/reference/api/using-pictures/

Related

Get Owner Profile Image Flikr API

I am using flickr API in my project, everything is working fine but i stuck at point where I am not able to get user's profile picture.
For example i am getting below type response
<user nsid="12037949754#N01" url="http://www.flickr.com/people/bees/" />
But not getting user image URL , can any one please help me out?
It's really very simple to find out the profile picture of any user which is called buddyicons. The API format/syntax is:
http://farm{icon-farm}.staticflickr.com/{icon-server}/buddyicons/{nsid}.jpg
For example: http://farm9.staticflickr.com/8573/buddyicons/116479554#N04.jpg
Here in this example, icon-farm=9, icon-server=8573 and nsid=116479554#N04
By default, the above example will give you default image of size 48*48(Each user has this size image may or may not exist large, medium images), but if you want large, medium, small profile pictures then just append _l, _m, and _s at the end of nsid respectively.
For example: http://farm9.staticflickr.com/8573/buddyicons/116479554#N04_l.jpg
Hope this help you and resolve your issue and might be useful to other users also who face the same issue.

How To Get Clear Image From FaceBook

I used graph API Json Response of Facebook Wall Post Images and display in my APP i successfully got it. But the wall images look very Blur how to resolve? i used this code for get wall picture
URL url=new URL(hashMap.get("picture_url"));
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap)
The Facebook Graph API as well as the FQL data set always returns the Picture URL of a thumbnail. If you look at the URL it returns, it will have one of these ending (right before the image extension .jpg, .png, etc) _t., _a.. For example, if the URL is to a JPG file, it could have an ending _t.jpg
The idea is to swap the ending and choose a normal size for the image that is returned. To do this, use the code below that will replace the endings with the one for normal sized images (that should have the _n.)
By the way, I don't think the tag you are looking for is picture_url. It should be just picture. But regardless, get the source URL as shown below, replace the endings and then pass it to the this line in your code:
// THIS SHOULD BE AFTER THE if....else code block
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
CODE TO REPLACE THE VARIOUS THUMBNAIL IMAGES: By the way, this is production code and works perfect.
String PICTURE_URL;
String getPicture = JOFeeds.getString("picture");
if (getPicture.contains("_t.")) {
PICTURE_URL = getPicture.replaceAll("_t.", "_n.");
} else if (getPicture.contains("_a.")) {
PICTURE_URL = getPicture.replaceAll("_a.", "_n.");
} else if (getPicture.contains("_s.")) {
PICTURE_URL = getPicture.replaceAll("_s.", "_n.");
} else if (getPicture.contains("_q.")) {
PICTURE_URL = getPicture.replaceAll("_q.", "_n.");
}
Note: However, in some cases, like a Video preview or a Link preview, it will not always have a bigger image available. Nothing much you can do about it nor can Facebook I suspect. These typically come from posts that are shared by users from other websites.

how to get clear image on Facebook Wall

I used graph API Json Response of facebook Wall POst Images and display in my APP i successfully got it. But the images look very Blur .. please tel me how to get clear images as like in Facebook
here is my code
URL url=new URL("http://graph.facebook.com/"+hashMap.get("id")+"/picture?type=normal");
Bitmap bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_ProfilePicture)).setImageBitmap(bitmap);
url=new URL(hashMap.get("picture_url"));
bitmap=BitmapFactory.decodeStream(url.openConnection().getInputStream());
((ImageView)view.findViewById(R.id.imageView_FullImage)).setImageBitmap(bitmap);
And in AsynTask
dobackground(){
hashMap.put("picture_url", data.getJSONObject(i).getString("picture"));
}
Use "/picture?type=large" instead of "/picture?type=normal" to get a slightly bigger picture.
While ?type=large provides a bigger image it may still not be large enough for a xhdpi display. You can actually specify a actual size now and they'll try their best to fulfill it.
For example this gives you a large square of Mark Zuckerberg:
http://graph.facebook.com/4/picture?width=500&height=500

Thumbnail image is posted to wall instead of full image using facebook graph api

I am using facebook graph api to post (message and image) to facebook wall.
This is the url I used
"https://graph.facebook.com/"+Login.facebookid+"/feed? access_token="+accesstoken+"&method="+"post"+"&message="+strFullMessage.replaceAll(" ", "%20")+"&link="+imageUrl +"&privacy="+result);
I expected the image to post in full size,but it is posting Thumbnail image.
I tried with all the three parameters in (/feed) like "source","picture","link".
But the image is posting in thumbnail.
Did facebook graph api allow to post full size image?
If possible how can I do this?
Thanks
As stated in the link https://developers.facebook.com/docs/reference/api/user/#photos an HTTP POST to PROFILE_ID/photos will give a full size photo to the timeline. You cannot have both a full size photo and a link. You can include a message.

Android Facebook API wall post with image url not working

This code WAS working fine, but suddenly stopped showing the map thumbnail from either Bing or Google static maps.. Any ideas? Did Facebook change their own parsing of the picture urls?
Bundle parameters = new Bundle();
parameters.putString("message", et_message.getText().toString());
parameters.putString("description", "Currently Near");
parameters.putString("picture","http://maps.google.com/maps/api/staticmap?center=36.837812,-76.022045&zoom=15&size=110x110&sensor=false&maptype=hybrid&markers=color:blue|36.837812,-76.022045");
parameters.putString("caption", lStreet + " - " + lCity +", "+ lState + " : "+ lPhone);
parameters.putString("name", lName);
if(lUrl != null){parameters.putString("link", lUrl);}
mAsyncRunner.request("me/feed", parameters,"POST", new myPostListener(), 1);
Now the Wall Post on my Facebook seems to be changing the link to combine parts of the LINK url, along with the image URL. I don't have a clear example of this that I can post, but a rough example is:
link = http://foo.bar/
picture = http://somemaps/image1.jpg
Result when hovering over the broken image on Facebook is something like:
http://apk.facebook/http://somemaps/image1.jpg
I don't get why Facebook isn't just using my raw picture Url in the first place!? Grrrrr
Anyone else having problem posting images to facebook wall, where image is a realtime generated image from Bing Maps, or Google Static Maps API?
I was having a similar issue and after a long debugging session it was due to me not providing a link and name attribute along with the picture attribute. I was just sending in message and picture but I think Facebook changed the way you can post pictures in a post recently because this did work about a month ago when I was testing.... Make sure they are all included in your post to Facebook. To post a picture you have to post to /me/photos, can't just send in a link unless you want it displayed as a "Facebook Link". Hope that helps.

Categories

Resources