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
Related
I am developing an application in which i am using Glide Library to load image from server. But Unfortunately this is not working and i am completely unaware about this and trying to solve this issue since last two days.
this is my code.
Glide.with(this).load(response.getBank_cash_deposit().getData().getAttributes().getAttachment()).into(mSelectedImage);
Try Log your image response. you're getting correct image URL or not.
If the image URL is correct then check whether there is space in your image URL or not.
If the space is exists then replace space in your URL String with %20 with the help of string.replace() function.
String image=response.getBank_cash_deposit().getData().getAttributes().getAttachment();
Log.d("Image",image);
if space exists
then
image.replace(" ","%20");
Also check image url on web.
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.
I have a quick question how to receive a jpg image from a web api call.
String result = webApiManager.getBarcode(dataStorageManager.currentUser.CustomerID);
This method returns a jpg image but I am unsure how to handle it and display it in an ImageView. Furthermore, what data type is a jpg image and how do I convert it into an image that I can display using an ImageView. Can someone point me in the right direction on how to accomplish this. Thanks for your time.
Regards,
Ryan
instead of returning the image as a jpg...why not just return the URL to the image and then use AsyncTask in processing it...
It will be easier and faster that way... just my 2cents
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.
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.