Skip to content
Snippets Groups Projects

Issue #2966656 by imclean, cilefen: Negotiate max width/height of oEmbed assets more intelligently

Closed Issue #2966656 by imclean, cilefen: Negotiate max width/height of oEmbed assets more intelligently
1 unresolved thread
1 unresolved thread

Closes #2966656

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
230 230 'frameborder' => 0,
231 231 'scrolling' => FALSE,
232 232 'allowtransparency' => TRUE,
233 'width' => $max_width ?: $resource->getWidth(),
234 'height' => $max_height ?: $resource->getHeight(),
233 'width' => $resource->getWidth() ?: $max_width,
234 'height' => $resource->getHeight() ?: $max_height,
  • Comment on lines +233 to +234

    Shouldn't that be something like:

    Suggested change
    Applied
    233 'width' => $resource->getWidth() ?: $max_width,
    234 'height' => $resource->getHeight() ?: $max_height,
    233 'width' => min(($resource->getWidth() ?: $max_width), $max_width),
    234 'height' => min(($resource->getHeight() ?: $max_height), $max_height),

    In case the value returned by the service is higher than the defined limit?

  • Stephen Mustgrave changed this line in version 2 of the diff

    changed this line in version 2 of the diff

  • This is unlikely. $max_width and $max_height are both submitted to the service and the values returned must be within those limits. The aim of this MR is to take advantage of that fact.

    The only exception I can think of is if the submitted values are lower than the service's minimum dimensions, in which case the minimum values would be returned.

  • makes sense, maybe a comment here would help understand the fact that the external service is not supposed to send something larger.

  • Please register or sign in to reply
  • Stephen Mustgrave resolved all threads

    resolved all threads

  • added 1 commit

    • 1ffc945b - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • Stephen Mustgrave added 83 commits

    added 83 commits

    • 1ffc945b...3d3b2c1d - 80 commits from branch project:11.x
    • ba624ecd - Merge branch '11.x' of git.drupal.org:project/drupal into 2966656-negotiate-max-widthheight
    • fb271d92 - Merge branch '2966656-negotiate-max-widthheight' of...
    • 6d835541 - PHPCS

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading