Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If this filter is enabled and not checked 'Users can override default video sizes', every image's width and height changed by this filter settings in content out of embed or object tags too.
Comments
Comment #1
l@va CreditAttribution: l@va commentedThis is a known issue, but with my understanding of PHP and regular expressions, I simply do not know how to fix it . The problem occurs in these 2 lines:
The regular expressions are matching
<img stuff="morestuff" width="$width">
in addition to just embed/object/iframe/param. In order to match only these, I would have to prepend a bunch of stuff (whitespace, attributes, etc) in front of the existing regular expressions, which I can do (e.g./<\s.*?embed[\sa-zA-Z=\d"\';\.]+*width=[\'"]?[0-9]{2,}p?[xt]?.?[\'"]?/
), but the problem is the replacement. If I do this, then it ends up changing $TAG_NAME to some fixed tag (e.g.<embed height=$HEIGHT width=$WIDTH src=$mytube_url>
becomeswidth=$WIDTH
), and the only thing we want to replace here is the width=NUMBER part. If someone can give me a pointer on replacing a subsection of a larger regular expression, I can fix this pretty easily. Anybody have any ideas?Until I know how to deal with this specific regular expression problem, the only workaround I can come up with is to turn off enforcement of width/height. If the setting is disabled, MyTube instead tries to parse out the width/height and make sure the thumbnail matches it.
Comment #2
Yaron Tal CreditAttribution: Yaron Tal commentedhttp://php.net/manual/en/function.preg-replace.php
So I'd try something like:
Don't know if it's the way to go though. Regexes aren't my thing either.
Comment #3
mfbThis is still a problem in the Drupal 7 branch if someone leaves the module with its default settings.
Comment #5
mfb