Tweaks to “width”
-
Please consider removing the hardcoded “px” appendix from the “max-width” clause in line 182. This allows for more user-flexibility, because you can use width=”70%” or width=”2em”, etc.
Simply change …
if(!empty($width)){ $style = <<<EOT <style> #$player { max-width:{$width}px; } </style> EOT; }
… to …
if(!empty($width)){ if (is_numeric($width[strlen($width) - 1])) { $width .= "px"; } $style = <<<EOT <style> #$player { max-width:{$width}; } </style> EOT; }
This will only add “px” to “$width” if the last character of width is numeric. Otherwise it will use the user’s input directly.
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Tweaks to “width”’ is closed to new replies.