WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Resize youTube on the fly? (6 posts)

  1. bcreighton
    Member
    Posted 6 years ago #

    Is there a way to resize youtube videos?

    My goal is to detect youtube videos and resize them to a certain width within a template so the post author doesn’t have to worry about it.

    Thanks!

  2. Adam Brown
    Member
    Posted 6 years ago #

    Maybe you could use javascript to find all the <objects> and set their width/height (whether they're from youtube or someplace else). The Prototype library would probably make this job easier.

    The trouble you would run into is this: Lots of folks use plugins that put their youtube videos into posts. I do. I just put a link to a youtube video in a post; the plugin uses javascript to find the link and replace it with <object> tags. You'd run into conflicts if folks used something like that.

    Why not just make the theme wide enough to accommodate the default video size?

  3. 4k
    Member
    Posted 6 years ago #

    perhaps use or study this plugin

  4. bcreighton
    Member
    Posted 6 years ago #

    Hmm, yeah - I guess that would work. I'd have to change the embed width as well. JS isn't my strong suit, but I'll try it.

    As far the theme, I'm just the front-end developer. The designer is ok with the user manually changing the width tag when they paste the code in. However, I would like to make that a bit more user friendly and automated.

    adamrbrown - what plugin do you use?

  5. Adam Brown
    Member
    Posted 6 years ago #

    I think I've still got Viper's Video Quicktags.

    Just remember, your JS will need to execute AFTER any of these plugins fire (so that all the objects/embeds are already created)--i.e. you'll probably want to execute your JS after the <?php wp_footer(); ?> tag in the template (since that tag is what sets off most of these types of plugins).

  6. bcreighton
    Member
    Posted 6 years ago #

    Looks like Viper's Video Quicktags is exactly what I need. Under options you can set a default width/height for each video format. Definitely customizable - thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic