WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#27563 closed defect (bug) (duplicate)

Embeds: Instagram image links to videos - do not show if content_width is bigger than 612px

Reported by: alexvorn2 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Embeds Keywords:
Focuses: Cc:
PR Number:

Description (last modified by SergeyBiryukov)

Not the same as this ticket! - #25795

But that ticket does not say that the image do not show if the width is bigger than 612px.

How to replicate:

  1. Edit $content_width value in Twenty Fourteen theme, in functions.php file from 474 to 613
  2. Insert a video link from Instagram, example- http://instagram.com/p/eoWiWak-Tf/ (found a working video)

View post, no image shown...

If we change to 612, then the image is shown.

Change History (5)

#1 @SergeyBiryukov
6 years ago

  • Description modified (diff)

#2 follow-up: @jesin
6 years ago

Problem is on Instagram's end it is not specific to videos but also affects images.

The URL in this JSON output displays an image.

curl -s 'http://api.instagram.com/oembed?url=http://instagram.com/p/eoWiWak-Tf/&maxwidth=612' | python -m json.tool
{
    "author_id": 30906272,
    "author_name": "kaushikpanchal",
    "author_url": "http://instagram.com/kaushikpanchal",
    "height": 612,
    "media_id": "551790071906559199_30906272",
    "provider_name": "Instagram",
    "provider_url": "http://instagram.com/",
    "title": "#mumbai #local",
    "type": "photo",
    "url": "http://distilleryimage7.ak.instagram.com/85bee01a24d511e3a17a22000a1fd129_7.jpg",
    "version": "1.0",
    "width": 612
}

The URL in this output returns a 403 error.

curl -s 'http://api.instagram.com/oembed?url=http://instagram.com/p/eoWiWak-Tf/&maxwidth=613' | python -m json.tool
{
    "author_id": 30906272,
    "author_name": "kaushikpanchal",
    "author_url": "http://instagram.com/kaushikpanchal",
    "height": 640,
    "media_id": "551790071906559199_30906272",
    "provider_name": "Instagram",
    "provider_url": "http://instagram.com/",
    "title": "#mumbai #local",
    "type": "photo",
    "url": "http://distilleryimage7.ak.instagram.com/85bee01a24d511e3a17a22000a1fd129_8.jpg",
    "version": "1.0",
    "width": 640
}

Setting a $content_width more than 640 returns a direct link to the video.

curl -s 'http://api.instagram.com/oembed?url=http://instagram.com/p/eoWiWak-Tf/&maxwidth=641' | python -m json.tool
{
    "author_id": 30906272,
    "author_name": "kaushikpanchal",
    "author_url": "http://instagram.com/kaushikpanchal",
    "height": 640,
    "media_id": "551790071906559199_30906272",
    "provider_name": "Instagram",
    "provider_url": "http://instagram.com/",
    "title": "#mumbai #local",
    "type": "photo",
    "url": "http://distilleryvesper7-19.ak.instagram.com/85bee01a24d511e3a17a22000a1fd129_101.mp4",
    "version": "1.0",
    "width": 640
}

But WordPress places this link inside the <img /> tag.

#3 in reply to: ↑ 2 @SergeyBiryukov
6 years ago

Replying to jesin:

The URL in this output returns a 403 error.

Related: #27237

#4 @SergeyBiryukov
6 years ago

  • Version changed from trunk to 3.5

#5 @wonderboymusic
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Instagram is returning bad values in their response. Even when they return an .mp4 in the response, they set the type equal to photo. Even if they set type equal to video, they don't return html, so we wouldn't parse it. #27237 is basically the same issue, can keep the conversation there.

Note: See TracTickets for help on using tickets.