stevenschobert / instafeed.js

A simple Instagram JavaScript plugin for your website
https://instafeedjs.com
MIT License
3.51k stars 859 forks source link

Avatar Image #257

Closed johnnydevs closed 9 years ago

johnnydevs commented 9 years ago

Is it possible to show the user instagram avatar/profile image next to the post?

My current code is as follows;

var userFeed = new Instafeed({
    get: 'user',
    userId: my_user_id,
    accessToken: 'my_token'
});,
template: '<a href="{{link}}" target="_blank"><img src="{{image}}" /></a>'
userFeed.run();

Thanks, J

stevenschobert commented 9 years ago

Yes, you can use <img src="{{model.user.profile_picture}}" /> in your template to display the users profile picture!

For a complete list of properties that are under model see #21.

johnnydevs commented 9 years ago

Excellent thanks for this plugin :)

aton1004 commented 7 years ago

Hi @stevenschobert ,

Great Extension!!! I tried to get profile picture from above mentioned approach using {{model.user.profile_picture}} in template but how can i get the profile picture only once, right now it is repeating with every post being pulled. How can I get the profile only once?

aton1004 commented 7 years ago

Hi @johnnydevs @stevenschobert ,

I could retrieve bio from {{model.user.bio}}. Is this depricated?? I read API documentation from instagram and it suggest we could use "users/self/" endpoint to get data. I could get response of bio if i hit "https://api.instagram.com/v1/users/self/?access_token=ACCESS_TOKEN" .

How can I get it through this plugin??

Any idea?? I am stuck as I am using this for shopify and i can do cross platform request for AJAX.

Please help me!!!

P42s commented 5 years ago

Merhaba @stevenschobert ,

Büyük Uzatma !!! Şablonda {{model.user.profile_picture}} şablonunu kullanarak yukarıda belirtilen yaklaşımdan profil resmi almaya çalıştım, ancak profil resmini yalnızca bir kez nasıl alabilirim, şu anda her yazı çekildiğinde tekrar ediyor. Profili yalnızca bir kez nasıl alabilirim?

Please reply, how it is made?

benjamin-hull commented 5 years ago

Hi @Serk4n,

I auto-translated your question, hopefully this is reasonable!

I tried to retrieve a profile picture from the above approach using the template {{model.user.profile_picture}} in the template, but how do I get the profile picture only once, it is repeating every time a post is drawn. How can I get the profile only once?

The template is used to render each Instagram post retrieved, so if you include {{model.user.profile_picture}}, you will see it displayed multiple times.

Instead, you can access the profile picture URL directly in javascript using the .success callback (see Advanced Options in the project README) and then accessing the user profile to get the image. See issue #21 for a reference to the properties of the image model.

P42s commented 5 years ago

Thanks @benjamin-hull