WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#28113 closed defect (bug) (worksforme)

class-wp-embed. height always fake in $attr

Reported by: alexufo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Embeds Keywords:
Focuses: Cc:

Description

1) open class-wp-embed.php at 185 and look for:

$cachekey = '_oembed_' . md5( $url . serialize( $attr ) );

2) add after

_log($attr);

and save file

3) reload any page of your blog with embeded content
( or any post with any youtube link example: http://www.youtube.com/watch?v=s3Mp7FY9oU0 )

4) open debug.log and see $attr array. The height will be always 960. Its never change by any embed url. I think 960 should be like attr height of embed html data.

Change History (7)

#1 follow-up: @wonderboymusic
7 years ago

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

alexufo, thanks for the report, but I can't reproduce your issue. I created an embed with width="300" and the height dynamically changed to 711

#2 in reply to: ↑ 1 @alexufo
7 years ago

Replying to wonderboymusic:

alexufo, thanks for the report, but I can't reproduce your issue. I created an embed with width="300" and the height dynamically changed to 711

Hmm.. trying again i lost my constant 960px. But... no matter.
Do you think how height can be more then width?) How cached height CAN BE 711px at 300px width?!
You can look real height of iframe through firebig.

#3 @alexufo
7 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Summary changed from class-wp-embed. height alwase 960 in $attr to class-wp-embed. height alwase fake in $attr

Guys and Girls. Why height always fake and not real of iframe in $attr?

#4 @SergeyBiryukov
6 years ago

  • Milestone set to Awaiting Review

#5 @SergeyBiryukov
6 years ago

  • Summary changed from class-wp-embed. height alwase fake in $attr to class-wp-embed. height always fake in $attr

#6 @wonderboymusic
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

Not all embeds are rendered in landscape orientation. Default is calculated like so:
$height = min( ceil( $width * 1.5 ), 1000 );

Default value for $width is 500, unless $GLOBALS['content_width'] is set.

This is working as expected. If you pass height to your embed shortcode, it will override this default value:
$attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );

#7 @helen
6 years ago

Also note that the oEmbed spec says that a provided width/height are to be treated as maximums in the response - we are providing sane limits, it is up to the provider to do the right thing with them.

Note: See TracTickets for help on using tickets.