WordPress.org

Forums

[Plugin: Viper's Video Quicktags] Resizing videos and keeping H/W proportion (10 posts)

  1. frmars
    Member
    Posted 5 years ago #

    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 :
    http://farm3.static.flickr.com/2749/4354634914_be4f3715dd_o.gif

    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 ?

  2. 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]
  3. frmars
    Member
    Posted 5 years ago #

    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 :

    [IF POST IS IN CATEGORY VIDEO, SHOW CONTENT, NOT EXCERPT]

    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 ?

  4. 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.

  5. frmars
    Member
    Posted 5 years ago #

    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 ?

    http://berendos.com/wp-content/uploads/2009/10/Chocolatssuisses.jpg

  6. frmars
    Member
    Posted 4 years ago #

    Hello,
    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 ?

    Thanks

  7. Please provide the <object> HTML. :)

    (wrap it in backticks)

  8. frmars
    Member
    Posted 4 years ago #

    Hi, here's the code.
    The tag is : "defaultSubtitle=fr"

    <object width="560" height="308"><param name="movie" value="http://www.dailymotion.com/swf/video/xed2bs?width=560&theme=none&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B&defaultSubtitle=fr&start=&animatedTitle=&additionalInfos=0&autoPlay=0&hideInfos=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/xed2bs?width=560&theme=none&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B&defaultSubtitle=fr&start=&animatedTitle=&additionalInfos=0&autoPlay=0&hideInfos=0 <http://www.dailymotion.com/swf/video/xed2bs?width=560&theme=none&foreground=%23F7FFFD&highlight=%23FFC300&background=%23171D1B&defaultSubtitle=fr&start=&animatedTitle=&additionalInfos=0&autoPlay=0&hideInfos=0> " width="560" height="308" allowfullscreen="true" allowscriptaccess="always"></embed></object>

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

    $this->swfobjects[$objectid] = array( 'width' => $atts['width'], 'height' => $atts['height'], 'url' => 'http://www.dailymotion.com/swf/' . $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' => 'http://www.dailymotion.com/swf/' . $videoid . '&colors=' . $backgroundcolor . $glowcolor . $foregroundcolor . $seekbarcolor . '&autoPlay=' . $autoplay . '&related=' . $related . '&defaultSubtitle=fr' );

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

  10. frmars
    Member
    Posted 4 years ago #

    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' => 'http://www.dailymotion.com/swf/' . $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 :
    http://www.enquete-debat.fr/archives/teaser-documentaire-sur-atlas-shrugged-dayn-rand/

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

Topic Closed

This topic has been closed to new replies.

About this Topic