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 1 year, 2 months ago.

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

    Rednasil
    Participant
    Post count: 28

    Hi,

    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

    (http://listarama.com/20-adorable-cats-dressed-as-superheroes/)

    But when I embed a youtube video (like on
    http://listarama.com/20-biggest-amusement-parks-across-europe/) 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?

    #60406

    AC
    Blocked
    Post count: 7712

    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.

    #60432

    Rednasil
    Participant
    Post count: 28

    Thanks for your reply Anitac,

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

    #60442

    AC
    Blocked
    Post count: 7712

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

    [php]if ( ! isset( $content_width ) ) $content_width = 600;[/php]

    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.

    #60444

    Rednasil
    Participant
    Post count: 28

    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) {

    extract(shortcode_atts(array(

    'id' => '',

    'align' => 'alignnone',

    'width' => '',

    'caption' => ''

    ), $attr));

    #60448

    Rednasil
    Participant
    Post count: 28

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

    Thanks alot Anitac.

    #60450

    AC
    Blocked
    Post count: 7712

    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.