Skip to content

Commit 261aebe

Browse files
committed
Fix vimeo thumbnails
1 parent 9be0d07 commit 261aebe

3 files changed

Lines changed: 21 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## 1.1.10 - 2021-06-03
8+
9+
### Fixed
10+
11+
- Fix vimeo thumbnails
12+
713
## 1.1.9 - 2021-04-17
814

915
### Fixed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "mikestecker/craft-videoembedder",
33
"description": "Craft plugin to generate an embed URL from a YouTube or Vimeo URL.",
44
"type": "craft-plugin",
5-
"version": "1.1.9",
5+
"version": "1.1.10",
66
"keywords": [
77
"craft",
88
"cms",

src/services/VideoEmbedderService.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public function getInfo($url)
4343
try {
4444
$embed = new Embed();
4545
$info = $embed->get($url);
46-
$response = $info->getOEmbed();
46+
47+
if ($this->isVimeo($url)) {
48+
$response = $info;
49+
} else {
50+
$response = $info->getOEmbed();
51+
}
4752
}
4853
catch (Exception $e)
4954
{
@@ -325,12 +330,18 @@ public function getVideoId($url)
325330
*
326331
**/
327332
public function getVideoThumbnail($url) {
333+
//return $this->getInfo($url)->getOEmbed()->all();
328334
// check for vimeo, I don't like the way Embed returns the Vimeo thumbnail
329-
if($this->getInfo($url)->get('type') && $this->isVimeo($url))
335+
if($this->isVimeo($url))
330336
{
331337
$id = $this->getVimeoId($url);
332338

333-
$data = file_get_contents("http://vimeo.com/api/v2/video/$id.json");
339+
$data = @file_get_contents("https://vimeo.com/api/v2/video/$id.json");
340+
341+
if ($data === FALSE) {
342+
return '';
343+
}
344+
334345
$data = json_decode($data);
335346

336347
$image = $this->cleanUrl($data[0]->thumbnail_large);

0 commit comments

Comments
 (0)