What is the method for obtaining a thumbnail of a Facebook profile picture?

Successfully retrieving album images from profile pictures using the following api call:

facebookModule.requestWithGraphPath("/"+albumId+"/photos", {
    fields : 'source,icon'
} [..]

My question now is whether there's a method to obtain profile picture icons directly from Facebook, or if I need to resize the source image manually in JavaScript. Appreciate any guidance on this matter. Thank you.

Answer №1

implement the FB.api method and include the field picture.width

FB.api('/me',{
    fields: 'name,id,picture.width(100).height(100)'
  }, function (result) {
    if (result && !result.error) {
     console.log(result);
    }
});

Answer №2

http://graph.facebook.com/[insert name or id]/profilepic

Illustration:

Answer №3

When utilizing the graph API, you will receive not only the source and icon of a picture, but also its unique Id. This Id can be used to reference specific pictures like so:

http://graph.facebook.com/{id}/picture?type=album

If you encounter a question mark photo, consider using the following format:

https://graph.facebook.com/{id}/picture?type=album&access_token={User accessToken}

It is crucial to send access tokens with query strings over HTTPS for security reasons.

You can specify the type as either thumbnail or normal when accessing the picture.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Change the CSS of a table row when a link is in focus

Is there a way to style a <tr> element when an <a> tag inside of it is focused? Below is the HTML for the table: <table> <tr> <td> <a href"#" tabindex="1" accesskey="e">edit</a> &l ...

How can I ensure a header is displayed on each page by utilizing CSS or JavaScript/jQuery?

On a lengthy page with approximately 15 pages of text, I would like to insert a header at the beginning of each page when the document is printed by the user. Can this functionality be achieved using CSS or JavaScript/jQuery? ...

SoundCloud authentication failed because the sign-in callback is attempting to access a frame from a different origin

Latest SoundCloud SDK Version About a year ago, I successfully registered my App. To my surprise, today I found that the SoundCloud (SC) sign-in feature is no longer working. Upon clicking the button, a SC pop-up window appears with the message "Allow ...

Guide to generating an array in JSON format within a dropdown menu option

Struggling to create a JSON array with select options instead of text fields? You're not alone. Spend hours trying to figure it out but still no luck? Take a look at this code snippet: function createJSON() { result = []; $("select[class=emai ...

struggling to send JSON data to PHP using AJAX

Here is the code snippet I am currently using. Javascript <script type="text/javascript"> var items = new Object(); items[0] = {'id':'0','value':'no','type':'img','filenam ...

increasing the size of the input thumb compared to the others

Hello fellow React developers, I'm currently learning by coding and I have a question about a slider. I'm trying to make the thumb of the slider bigger, but when I increase its size it doesn't fully display within the input area (as you can ...

Unable to resume playback on HTML5 video after pausing

I am having trouble with the auto pause and manual play issue. The video pauses after 2 seconds, which is expected. However, I would like to have a button that when clicked, resumes playback from where it was paused. Below is my HTML code: <div class= ...

What are the steps to switch to a root page after a successful sign-in with Ember-Auth?

After successfully implementing Ember-Auth using a pure token based approach, I am facing a challenge in redirecting users to the root of my app once they sign in. Although I know about actionRedirectable (refer to for details), since I am using a pure t ...

Undesirable flickering animation on button

Is there a way to display a dynamic button that follows the mouse cursor when hovering over an image? If you want to see the code in action, check out this codepen link. const box = document.getElementById("box"); function movebox(e) { box.style.lef ...

PhantomJs is only providing partial responses

I have been attempting to retrieve a response from the following URL using PhantomJS:- https://www.trivago.com/api/v1/bin/accommodation/2891353/deals?iPathId=34812&iRoomType=1&aRooms=&aDateRange%5Barr%5D=2017-05-24&aDateRange%5Bdep%5D=2017 ...

Having trouble with AngularJS ngRepeat not functioning properly?

Currently, I am utilizing AngularJs to showcase Google maps with markers. Upon clicking a marker, I am aiming to display the details of the clicked marker. Here is the content of my Controller.js: function createMarker(latitude,longitude,name,address,lo ...

What sets apart window.location = MVC File() from the success( window.location = result ) in $.ajax?

These two snippets of code may seem similar in function, but they actually behave differently: window.location = "../PlanView/ExportAsPDF"; $.ajax({ url: '../PlanView/ExportAsPDF', data: { }, success: function (stream) { window.loca ...

Is it necessary to always provide a return value from a redux middleware function?

After reviewing the various examples provided in the redux documentation, it seems like there is always a return value from the middlewares. However, in my experience, simply calling next(action) and not returning anything seems to work without any issues. ...

Encountered a TypeScript issue when using React and Slate: The property 'renderElement' is not found on type 'IntrinsicAttributes'

Currently, I am working on mastering Slate by following the steps outlined in this tutorial: Defining Custom Elements. After adapting the code slightly from the tutorial, here is what I have integrated: export default function App() { const renderEleme ...

The color of the background does not remain changed permanently

I'm having an issue where the background color changes when I click a button, but reverts back almost immediately to its original color. How can I ensure that the new color stays permanently? Here is a simple JavaScript function you can use: functio ...

What is the functionality of intro.js?

Currently, I am utilizing an onboarding tour at my.bonify.de that provides a similar experience to introjs. The way we have implemented this feature is quite unattractive, using a cutout div with a very large box-shadow. We are looking to enhance it by in ...

Having trouble with getting tags to function on the Facebook iOS SDK 3.0 platform

Here's a simplified version of the code I'm working with: id<SCOGMyAction> action = (id<SCOGMyAction>)[FBGraphObject graphObject]; action.user_message = @"My Message"; action.place = selectedPlace; <-- FBGraphPlace action.tags = s ...

In VB.Net, utilize regex to eliminate whitespace except for the content within <script> tags

I'm seeking a solution to minimize the size of my HTML output stream by eliminating empty lines and whitespace. I've attempted using regex, but my current pattern is inadvertently removing entire script blocks. How can I refine my approach to ens ...

Mastering data extraction from JSON using React JS (with Axios)

Being new to ReactJS and axios, I am facing a challenge. I need to iterate through JSON data and extract values where the key is a number (e.g. 0, 1, 2...). However, I am unsure how to implement this in my code since the server provides dynamic JSON data ...

When using setTimeout in NodeJS/Express, a TypeError is thrown stating that it cannot read the property 'client' as it is undefined

My nodejs express route is basic: app.get('/timeout', function (req, res) { setTimeout(() => { console.log('timeout'); }, 2000); res.send({ hello: "world" }); }); However, it's not functioning cor ...