Pictures Size Change When Youtube Video is Embedded In Metro

Community Forums Forums General Discussion Pictures Size Change When Youtube Video is Embedded In Metro

This topic is: resolved

This topic contains 6 replies, has 2 voices, and was last updated by  AC 2 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #60375



    I have a little problem with the pictures on my site. When I first add them to the post they are just full size, like this one


    But when I embed a youtube video (like on the whole formatting changes and the pictures appear smaller and not aligned well.

    And I only see half the pictures on mobile on both posts.

    Anyone any suggestion on how to fix this?



    It looks like you are adding the iFrame version of the embed code. WordPress added an update to the platform that allows you to just add the URL of the video and it will encode it on to the page for you without using the embed code. You should click the Share button on the video, grab that URL. Then go to the post, select the Text tab and not the virtual tab – paste the URL and Publish/Update. View the post and you will see the video. Try that and see how your images come out.



    Thanks for your reply Anitac,

    But I’m actually using the youtube url to embed the videos.



    Okay, try adding this to your Functions.php file at the bottom:

    if ( ! isset( $content_width ) ) $content_width = 600;

    You can adjust the 600 to whatever width you want the video to automatically size at. See if this makes a difference with your images. I added this to one of my clients and it seems to work for them.



    Before I add the code to my site, I need to say that I think I found what is causing all this.
    I used this code to add credits to my photo captions.

    `add_filter('img_caption_shortcode', 'caption_shortcode_with_credits', 10, 3);

    function caption_shortcode_with_credits($empty, $attr, $content) {


    'id' => '',

    'align' => 'alignnone',

    'width' => '',

    'caption' => ''

    ), $attr));



    Okey, I went ahead and added your code anyways and it helped. My pictures are back at their normal size.

    Thanks alot Anitac.



    Oh good. I don’t know why some people have the “tiny” image problem and others don’t. Glad it worked for you.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.