backdrop-contrib / video_filter

A Backdrop CMS port of drupal.org/project/video_filter, a highly flexible and easily extendable filter module to embed any type of video in your site using a simple token.
GNU General Public License v2.0
2 stars 2 forks source link

Allow units of px for width and height. #3

Closed Radcliffe closed 5 years ago

Radcliffe commented 5 years ago

When embedding a video, the user can optionally specify the height and width. For example,

 [video: https://vimeo.com/293328251 width: 600 height: 400]

The width and height are numbers, but in CSS one usually includes "px" to indicate that the width and height are measured in pixels. If the user writes 600px instead of 600, then video processing fails, and an obscure error message is generated.

 Notice: A non well formed numeric value encountered in _video_filter_process() (line 212 of 
 [...] /web/modules/video_filter/video_filter.module).

This may be user error, but the documentation doesn't explicitly state that the units should be omitted from the width and height. I suggest that units should be removed automatically if present, for example by inserting the following lines of code:

$video['height'] = intval($video['height']);
$video['width'] = intval($video['width']);