Search code examples
phpvimeo

Vimeo thumbnail larger than 640px


I'm using code similar to this to add thumbnails of vimeo videos to a page.

    <?php

        if(defined('AT_PROXY'))  {
              $aContext = array(
                  'http' => array(
                      'proxy' => AT_PROXY,
                      'request_fulluri' => true,
                  ),
              );
              $cxContext = stream_context_create($aContext);

              $contents = file_get_contents('http://vimeo.com/api/v2/video/'.$main_video.'.php', False, $cxContext);
         } else {
              $contents = file_get_contents('http://vimeo.com/api/v2/video/'.$main_video.'.php');
         }

        $main_video = 9700052;     

        $contents = file_get_contents('http://vimeo.com/api/v2/video/'.$main_video.'.php');

        $array = @unserialize(trim($contents));
        $video_thumbnail = str_replace('http://', 'https://',$array[0]["thumbnail_large"]);
    ?>

     <div class="video_thumbnail text-center">

          <img src="<?php echo $video_thumbnail ?>" alt="" class="img-responsive" />

          <div class="play js-play" data-vid="<?php echo $main_video; ?>">
               <span class="glyphicon glyphicon-play play-btn"></span>
          </div>

     </div>

I'm using Javascript to play the movie when the js-play button is clicked.

My problem is the size of the thumbnail, the large size is 640px but I would like it slightly larger.

Is it possible to get the vimeo thumbnail at a larger size.


Solution

  • If the biggest size Vimeo gives is 640px you can resize the image with CSS.

     <img src="<?php echo $video_thumbnail ?>" alt="" class="img-responsive video-thumbnail" />
    

    CSS:

    .video_thumbnail {
      width: 760px;
      height: 450px;
    }