Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Instagram API custom image width

Tags:

php

instagram

I am trying to set custom width for images in Instagram, using Instagram API. I am using hashtag to grab all images related. Can I ask Instagram to serve me custom image sizes? I know there are 3 sizes: thumbnail, low_resolution, standard_resolution. Is that all what I can get? Thanks!

like image 824
Bob Avatar asked Dec 24 '12 01:12

Bob


Video Answer


2 Answers

Instagram API returns three standard image resolutions. There is an additional undocumented image size that you could also use however, this might be a bit brittle/liable change in the future and it may also be against their terms of service (not sure). I noticed that this image was available when I saw that the Instagram website was serving up higher resolution images- I'm not really sure why Instagram choose not to make this image available.

From the API, you can get these standard image sizes:

thumbnail (150 x 150)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11821182_168255950173048_11130460_n.jpg

low_resolution (320 x 320)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s320x320/e15/11821182_168255950173048_11130460_n.jpg

standard resolution (640 x 640)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s640x640/sh0.08/e35/11821182_168255950173048_11130460_n.jpg

Then, by looking at their website, I noticed they served up a larger version of the file at 1080 x 1080:

undocumented large image (1080 x 1080)

https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s1080x1080/e15/11821182_168255950173048_11130460_n.jpg

like image 192
Willster Avatar answered Oct 04 '22 16:10

Willster


Simple do a search and replace on _5 (or _6, ie) to get get your desired size (see below):

Image sizes appear to be:

http://distilleryimage7.s3.amazonaws.com/xxxxxxxxx_7.jpg

612px × 612px

http://distilleryimage7.s3.amazonaws.com/xxxxxxxxx_6.jpg

306px × 306px

http://distilleryimage7.s3.amazonaws.com/xxxxxxxxx_5.jpg

150px × 150px

It appears _8,_4,_3 are not valid sizes.

like image 36
Metablocks Corp Avatar answered Oct 04 '22 16:10

Metablocks Corp