Support » Plugins » [Plugin: Viper’s Video Quicktags] Resizing videos and keeping H/W proportion

  • Eeeeeeeerhhh… I am so tired.

    I am using Viper to publish my videos. And I have been trying for hours, changed all the css, twiggled all the parameters I could think of, looked everywhere on the web. No solution.

    Look at screen capture :

    I have two columns. I want them both to display video (if neeeded) and I’d just like the size of the embedded video to adapt itself nicely.

    So… WHY WON’T the video box diminish in height to adapt itself and keep aspect ratio without leaving this ugly black spaces ?

    Is that too much to ask ?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Actually yes, it is too much to ask. 🙂

    The reason the video on the right side is narrower than the one on the left is because there is CSS that says max-width: 100% which makes the browser squish it horizontally to fit. It’s not possible for the browser to proportionally resize it (without maybe some crazy Javascript solution).

    You can do it manually though. In your sidebar video, just define a width/height:

    [youtube width="123" height="456"]video url[/youtube]

    hu… All right (deep sigh).

    Look again at the screen capture : on my front page, many articles will just show excerpts (especially in the small column)

    1) No excerpt would ever show the video.
    I tried with “advanced excerpt” and a few other plugins. But the shortcode was never interpreted. I tried custom excerpts as well. No success.

    I have tried to add this to functions.php :

    add_filter('the_excerpt', 'do_shortcode', 11);

    But it did nothing. That’s why I had to introduce a condition :


    But you might have an idea on how Viper shortcode can be interpreted by the excerpt. Have you ?

    2) I would also need the video to show full (or larger) size when I open the article in a single page. If I set a small size to fit the column, the video will be, well, small too.

    How would you solve this issue ?

    1) My plugin has not designed to work with excerpts. You’re welcome to submit a patch to make it work with them though and I’ll consider it for inclusion.

    2) Try this something like this:

    add_filter( 'vvq_shortcodeatts', 'frmars_vvq_modifier', 10, 3 );
    function frmars_vvq_modifier( $atts, $tag, $rawatts ) {
    	if ( is_singular() ) {
    		$atts['width'] = 123;
    		$atts['height'] = 456;
    	return $atts;

    That will override the width/height and force it to those dimensions when viewing a post or page in it’s singular view.

    Geee ! Woooow ! Works very nicely !

    (and — sob, sob — so far above my head from a programming point of view)

    You should definitely include this option in a future version.

    Many thanks. Where do I send the chocolate box ?

    You helped me recently (see above messages) and it did the trick quite well.

    I am now faced with a new problem :

    On Dailymotion (and probably youtube), the “long” <object> xxx </object> code allows to include several options. And particularly one — which is my present problem —, the default display of subtitles.

    So here is the problem :
    I subtitle videos in French thanks to Dailymotion’s custom tools, and it is possible to have the subtitles displayed by default thanks to html code : “blablabla&subtitles=default&lang=fr” (or something like that).

    HOWEVER, my site in entirely dependent the on Viper plugin for the display of videos (because they have to adapt in size according to whether they are on homepage or not).

    • If I use the “object” code, I can display my subtitles, but the size is fixed, and I am scre_wed.
    • If I use a Viper quicktag, I can’t display subtitles and I am scre_wed as well.

    Is there a way to include in viper quicktag some bizarre options in a way or another, so I can finally display my flipping subtitles ?


    Please provide the <object> HTML. 🙂

    (wrap it in backticks)

    Hi, here’s the code.
    The tag is : “defaultSubtitle=fr”

    <object width="560" height="308"><param name="movie" value=""></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src=" <> " width="560" height="308" allowfullscreen="true" allowscriptaccess="always"></embed></object>

    Line 2989 of my plugin, inside of the shortcode_dailymotion() function:

    $this->swfobjects[$objectid] = array( 'width' => $atts['width'], 'height' => $atts['height'], 'url' => '' . $videoid . '&colors=' . $backgroundcolor . $glowcolor . $foregroundcolor . $seekbarcolor . '&autoPlay=' . $autoplay . '&related=' . $related );

    Replace it with this:

    $this->swfobjects[$objectid] = array( 'width' => $atts['width'], 'height' => $atts['height'], 'url' => '' . $videoid . '&colors=' . $backgroundcolor . $glowcolor . $foregroundcolor . $seekbarcolor . '&autoPlay=' . $autoplay . '&related=' . $related . '&defaultSubtitle=fr' );

    I’ll make it an option in my next major release.

    Right. Thanks. Your code didn’t work at first. I took a look at the source code, compared again the Dailymotion object code with and without the subtitle stuff.

    It appears (just a guess) that the place where the tag is introduced matters. ANyway, I tried this and it seems to be working :

    $this->swfobjects[$objectid] = array( 'width' => $atts['width'], 'height' => $atts['height'], 'url' => '' . $videoid . '&colors=' . $backgroundcolor . $glowcolor . $foregroundcolor . $seekbarcolor . '&autoPlay=' . $autoplay . '&defaultSubtitle=fr&related=' . $related );

    Well, I am not sure in fact. I’ve made several tests on various browsers. It just seems to vary, and I have no idea why.

    Test for yourself here :

    If you see subtibles on the video, it works (for you). My own tests are unconclusive.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Viper’s Video Quicktags] Resizing videos and keeping H/W proportion’ is closed to new replies.