Version Description
- Added
get_video_thumbnail()
to return the URL without echoing or return null if no thumbnail is found, making it possible to only display a thumbnail if one is found.
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.3 to 0.2
- readme.txt +5 -28
- video-thumbnails.php +5 -36
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sutherlandboswell.com
|
|
4 |
Tags: Video, YouTube, Vimeo, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.0.1
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Video Thumbnails is a simple plugin that makes it easier to display video thumbnails in your template.
|
10 |
|
@@ -14,11 +14,9 @@ Video Thumbnails makes it simple to display video thumbnails in your templates.
|
|
14 |
|
15 |
Video Thumbnails currently supports:
|
16 |
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
20 |
-
* JR Embed (this plugin seems to have disappeared)
|
21 |
-
* [Vimeo Shortcode](http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-in-wordpress/)
|
22 |
|
23 |
When using `video_thumbnail()` and no thumbnail is found, a default thumbnail is echoed, which can be changed by replacing the `default.jpg` file found in your `/plugins/video-thumbnails/` directory.
|
24 |
|
@@ -48,18 +46,6 @@ Coming Soon
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
-
= 0.3 =
|
52 |
-
* Added basic support for Blip.tv auto embedded using URLs in this format: http://blip.tv/file/12345
|
53 |
-
|
54 |
-
= 0.2.3 =
|
55 |
-
* Added support for any Vimeo URL
|
56 |
-
|
57 |
-
= 0.2.2 =
|
58 |
-
* Added support for [Vimeo Shortcode](http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-in-wordpress/)
|
59 |
-
|
60 |
-
= 0.2.1 =
|
61 |
-
* Added support for Vimeo players embedded using an iframe
|
62 |
-
|
63 |
= 0.2 =
|
64 |
* Added `get_video_thumbnail()` to return the URL without echoing or return null if no thumbnail is found, making it possible to only display a thumbnail if one is found.
|
65 |
|
@@ -79,13 +65,4 @@ Coming Soon
|
|
79 |
== Known Issues ==
|
80 |
|
81 |
* The Vimeo API is rate limited, so the default image will be displayed when the limit has been exceeded. I'm planning to add local copies of files in a future release to solve this problem.
|
82 |
-
* While not really an issue, the current method for only displaying a thumbnail if one is found seems like it could be streamlined, so if you have any suggestions let me know.
|
83 |
-
|
84 |
-
== Roadmap ==
|
85 |
-
|
86 |
-
This plugin is still very young, and has a future planned as the ultimate plugin for video thumbnails. Here's some of the planned additions:
|
87 |
-
|
88 |
-
* More comprehensive Blip.tv support
|
89 |
-
* Local thumbnail storage
|
90 |
-
* More services
|
91 |
-
* More shortcode plugins
|
4 |
Tags: Video, YouTube, Vimeo, Thumbnails
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.0.1
|
7 |
+
Stable tag: 0.2
|
8 |
|
9 |
Video Thumbnails is a simple plugin that makes it easier to display video thumbnails in your template.
|
10 |
|
14 |
|
15 |
Video Thumbnails currently supports:
|
16 |
|
17 |
+
* YouTube
|
18 |
+
* Vimeo
|
19 |
+
* JR Embed (uses `[youtube id=VIDEO_ID]` to embed videos, I've modified mine to also allow `[vimeo id=VIDEO_ID]`)
|
|
|
|
|
20 |
|
21 |
When using `video_thumbnail()` and no thumbnail is found, a default thumbnail is echoed, which can be changed by replacing the `default.jpg` file found in your `/plugins/video-thumbnails/` directory.
|
22 |
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
= 0.2 =
|
50 |
* Added `get_video_thumbnail()` to return the URL without echoing or return null if no thumbnail is found, making it possible to only display a thumbnail if one is found.
|
51 |
|
65 |
== Known Issues ==
|
66 |
|
67 |
* The Vimeo API is rate limited, so the default image will be displayed when the limit has been exceeded. I'm planning to add local copies of files in a future release to solve this problem.
|
68 |
+
* While not really an issue, the current method for only displaying a thumbnail if one is found seems like it could be streamlined, so if you have any suggestions let me know.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
video-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://sutherlandboswell.com/2010/11/wordpress-video-thumbnails/
|
|
5 |
Description: A plugin designed to fetch video thumbnails. Use <code><?php video_thumbnail(); ?></code> in a loop to return a URL for the thumbnail of the first video in a post. Currently works with YouTube and Vimeo, and with the JR_embed plugin.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
-
Version: 0.
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
@@ -38,16 +38,6 @@ function getVimeoInfo($id, $info = 'thumbnail_large') {
|
|
38 |
return $output;
|
39 |
};
|
40 |
|
41 |
-
// Blip.tv Functions
|
42 |
-
function getBliptvInfo($id) {
|
43 |
-
$xml = simplexml_load_file("http://blip.tv/file/$id?skin=rss");
|
44 |
-
$result = $xml->xpath("/rss/channel/item/media:thumbnail/@url");
|
45 |
-
foreach($result as $element) {
|
46 |
-
$thumbnail = $element["url"];
|
47 |
-
}
|
48 |
-
return $thumbnail;
|
49 |
-
}
|
50 |
-
|
51 |
// The Main Event
|
52 |
function get_video_thumbnail() {
|
53 |
|
@@ -76,25 +66,10 @@ function get_video_thumbnail() {
|
|
76 |
else {
|
77 |
preg_match('#<object[^>]+>.+?http://vimeo.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)&.+?</object>#s', $markup, $matches);
|
78 |
|
79 |
-
// Find Vimeo embedded with iframe code
|
80 |
-
if(!isset($matches[1])) {
|
81 |
-
preg_match('#http://player.vimeo.com/video/([0-9]+)#s', $markup, $matches);
|
82 |
-
}
|
83 |
-
|
84 |
// If we still haven't found anything, check for Vimeo embedded with JR_embed
|
85 |
if(!isset($matches[1])) {
|
86 |
preg_match('#\[vimeo id=([A-Za-z0-9\-_]+)]#s', $markup, $matches);
|
87 |
-
}
|
88 |
-
|
89 |
-
// If we still haven't found anything, check for Vimeo URL
|
90 |
-
if(!isset($matches[1])) {
|
91 |
-
preg_match('#http://www.vimeo.com/([A-Za-z0-9\-_]+)#s', $markup, $matches);
|
92 |
-
}
|
93 |
-
|
94 |
-
// If we still haven't found anything, check for Vimeo shortcode
|
95 |
-
if(!isset($matches[1])) {
|
96 |
-
preg_match('#\[vimeo clip_id="([A-Za-z0-9\-_]+)"[^>]*]#s', $markup, $matches);
|
97 |
-
}
|
98 |
|
99 |
// Now if we've found a Vimeo ID, let's return the thumbnail
|
100 |
if(isset($matches[1])) {
|
@@ -107,15 +82,9 @@ function get_video_thumbnail() {
|
|
107 |
}
|
108 |
}
|
109 |
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
if(isset($matches[1])) {
|
114 |
-
return getBliptvInfo($matches[1]);
|
115 |
-
}
|
116 |
-
else {
|
117 |
-
return null;
|
118 |
-
}
|
119 |
}
|
120 |
}
|
121 |
|
5 |
Description: A plugin designed to fetch video thumbnails. Use <code><?php video_thumbnail(); ?></code> in a loop to return a URL for the thumbnail of the first video in a post. Currently works with YouTube and Vimeo, and with the JR_embed plugin.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
+
Version: 0.2
|
9 |
License: GPL2
|
10 |
*/
|
11 |
/* Copyright 2010 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
38 |
return $output;
|
39 |
};
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
// The Main Event
|
42 |
function get_video_thumbnail() {
|
43 |
|
66 |
else {
|
67 |
preg_match('#<object[^>]+>.+?http://vimeo.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)&.+?</object>#s', $markup, $matches);
|
68 |
|
|
|
|
|
|
|
|
|
|
|
69 |
// If we still haven't found anything, check for Vimeo embedded with JR_embed
|
70 |
if(!isset($matches[1])) {
|
71 |
preg_match('#\[vimeo id=([A-Za-z0-9\-_]+)]#s', $markup, $matches);
|
72 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
// Now if we've found a Vimeo ID, let's return the thumbnail
|
75 |
if(isset($matches[1])) {
|
82 |
}
|
83 |
}
|
84 |
|
85 |
+
// If nothing has been found, show the default
|
86 |
+
else {
|
87 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
}
|
90 |
|