Retrieve Media by Instagram ID

Get information about a media object owned by the authorized Instagram user.

This is the how the Pic Puller Instagram Image Browser field type would integrate into Craft templates. Instead of passing in a predefined media_id as this example does, you would use the value generated by the Image Browser. 


Documentation for this code example: Media by ID

The code block below is generating the section that follows it.

{% for instagramdata in craft.picpuller.media({'use_stale_cache' : TRUE, 'user_id' : 1, 'media_id': '1209557797210819201_1500897'}) %}
  {% if loop.first %}
    <p>Status: {{ instagramdata.status }}</p>
    <p>Error Type: {{ instagramdata.error_type }}</p>
    <p>Error Message: {{ instagramdata.error_message }}</p>
    <hr>
  {% endif %}
  {% if instagramdata.status == 'true' %}
    <p>username: {{ instagramdata.username }}</p>
    <p>full_name: {{ instagramdata.full_name }}</p>
    <p><img src="{{instagramdata.low_resolution}}" alt='{{instagramdata.caption}}'></p>
    <p><em>Caption</em>: {{instagramdata.caption}}</p>
   {% if instagramdata.caption is not empty %}
        <p><em>Caption only: </em>{{ instagramdata.caption_only }}</p>
        <p><em>Tags ({{ instagramdata.tags|length }} in total): </em>
        {% for zeroBasedCounter, tag in instagramdata.tags %}
            <span>{{ tag }}</span>{% if zeroBasedCounter+1 < instagramdata.tags|length %}, {% endif %}
        {% endfor %}
        </p>
    {% endif %}
    <p>created_time: {{ instagramdata.created_time }}</p>
  {% else %}
    <p>Error Type: {{ instagramdata.error_type }}</p>
    <p>Error Message: {{ instagramdata.error_message }}</p>
  {% endif %}
{% endfor %}

Status: 1

Error Type: NoError

Error Message: Nothing wrong here. Move along.


username: johnfmorton

full_name: John Morton

Skate or don't skate? Skate. #nyc #graffiti

Caption: Skate or don't skate? Skate. #nyc #graffiti

Caption only: Skate or don't skate? Skate.

Tags (2 in total): graffiti, nyc

created_time: 1458410547