Video Thumbnails - Version 2.7.3

Version Description

  • Improved image download test
  • Updated Vimeo and VK tests
Download this release

Release Info

Developer sutherlandboswell
Plugin Icon 128x128 Video Thumbnails
Version 2.7.3
Comparing to
See all releases

Code changes from version 2.7.2 to 2.7.3

js/settings.js CHANGED
@@ -15,6 +15,28 @@ jQuery(function ($) {
15
  });
16
  });
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  });
19
 
20
  // Test actions
15
  });
16
  });
17
 
18
+ $('#test-video-thumbnail-saving-media').on('click',function(e) {
19
+ $('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
20
+ e.preventDefault();
21
+ var data = {
22
+ action: 'video_thumbnail_image_download_test'
23
+ };
24
+ $.post(ajaxurl, data, function(response){
25
+ $('#media-test-result').html(response);
26
+ });
27
+ });
28
+
29
+ $('#delete-video-thumbnail-test-images').on('click',function(e) {
30
+ $('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
31
+ e.preventDefault();
32
+ var data = {
33
+ action: 'video_thumbnail_delete_test_images'
34
+ };
35
+ $.post(ajaxurl, data, function(response){
36
+ $('#media-test-result').html(response);
37
+ });
38
+ });
39
+
40
  });
41
 
42
  // Test actions
php/class-video-thumbnails-settings.php CHANGED
@@ -43,7 +43,8 @@ class Video_Thumbnails_Settings {
43
  add_action( 'wp_ajax_clear_all_video_thumbnails', array( &$this, 'ajax_clear_all_callback' ) );
44
  // Ajax test callbacks
45
  add_action( 'wp_ajax_video_thumbnail_provider_test', array( &$this, 'provider_test_callback' ) ); // Provider test
46
- add_action( 'wp_ajax_video_thumbnail_saving_media_test', array( &$this, 'saving_media_test_callback' ) ); // Saving media test
 
47
  add_action( 'wp_ajax_video_thumbnail_markup_detection_test', array( &$this, 'markup_detection_test_callback' ) ); // Markup input test
48
  // Settings page actions
49
  if ( isset ( $_GET['page'] ) && ( $_GET['page'] == 'video_thumbnails' ) ) {
@@ -274,21 +275,43 @@ class Video_Thumbnails_Settings {
274
  <?php die();
275
  } // End provider test callback
276
 
277
- function saving_media_test_callback() {
278
 
279
  // Try saving 'http://img.youtube.com/vi/dMH0bHeiRNg/0.jpg' to media library
280
  $attachment_id = Video_Thumbnails::save_to_media_library( 'http://img.youtube.com/vi/dMH0bHeiRNg/0.jpg', 1 );
281
  if ( is_wp_error( $attachment_id ) ) {
282
  echo '<p><span style="color:red;">&#10006;</span> ' . $attachment_id->get_error_message() . '</p>';
283
  } else {
284
- echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment created with an ID of %d', 'video-thumbnails' ), $attachment_id ) . '</p>';
285
- wp_delete_attachment( $attachment_id, true );
286
- echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment with an ID of %d deleted', 'video-thumbnails' ), $attachment_id ) . '</p>';
 
 
 
 
287
  }
288
 
289
  die();
290
  } // End saving media test callback
291
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  function markup_detection_test_callback() {
293
 
294
  $new_thumbnail = null;
@@ -555,9 +578,12 @@ class Video_Thumbnails_Settings {
555
 
556
  <p><?php _e( 'Also be sure to test that you can manually upload an image to your site. If you\'re unable to upload images, you may need to <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a>.', 'video-thumbnails' ); ?></p>
557
 
558
- <div id="saving_media-test">
559
- <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('saving_media');" value="<?php esc_attr_e( 'Test Image Downloading', 'video-thumbnails' ); ?>" /></p>
560
- </div>
 
 
 
561
 
562
  <h3><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3>
563
  <table class="widefat">
43
  add_action( 'wp_ajax_clear_all_video_thumbnails', array( &$this, 'ajax_clear_all_callback' ) );
44
  // Ajax test callbacks
45
  add_action( 'wp_ajax_video_thumbnail_provider_test', array( &$this, 'provider_test_callback' ) ); // Provider test
46
+ add_action( 'wp_ajax_video_thumbnail_image_download_test', array( &$this, 'image_download_test_callback' ) ); // Saving media test
47
+ add_action( 'wp_ajax_video_thumbnail_delete_test_images', array( &$this, 'delete_test_images_callback' ) ); // Delete test images
48
  add_action( 'wp_ajax_video_thumbnail_markup_detection_test', array( &$this, 'markup_detection_test_callback' ) ); // Markup input test
49
  // Settings page actions
50
  if ( isset ( $_GET['page'] ) && ( $_GET['page'] == 'video_thumbnails' ) ) {
275
  <?php die();
276
  } // End provider test callback
277
 
278
+ function image_download_test_callback() {
279
 
280
  // Try saving 'http://img.youtube.com/vi/dMH0bHeiRNg/0.jpg' to media library
281
  $attachment_id = Video_Thumbnails::save_to_media_library( 'http://img.youtube.com/vi/dMH0bHeiRNg/0.jpg', 1 );
282
  if ( is_wp_error( $attachment_id ) ) {
283
  echo '<p><span style="color:red;">&#10006;</span> ' . $attachment_id->get_error_message() . '</p>';
284
  } else {
285
+ update_post_meta( $attachment_id, 'video_thumbnail_test_image', '1' );
286
+ $image = wp_get_attachment_image_src( $attachment_id, 'full' );
287
+ echo '<img src="' . $image[0] . '" style="float:left; max-width: 250px; margin-right: 10px;">';
288
+ echo '<p><span style="color:green;">&#10004;</span> ' . __( 'Attachment created', 'video-thumbnails' ) . '</p>';
289
+ echo '<p><a href="' . get_edit_post_link( $attachment_id ) . '">' . __( 'View in Media Library', 'video-thumbnails' ) . '</a></p>';
290
+ echo '<a href="' . $image[0] . '" target="_blank">' . __( 'View full size', 'video-thumbnails' ) . '</a>';
291
+ echo '<span style="display:block;clear:both;"></span>';
292
  }
293
 
294
  die();
295
  } // End saving media test callback
296
 
297
+ function delete_test_images_callback() {
298
+ global $wpdb;
299
+ // Clear images from media library
300
+ $media_library_items = get_posts( array(
301
+ 'showposts' => -1,
302
+ 'post_type' => 'attachment',
303
+ 'meta_key' => 'video_thumbnail_test_image',
304
+ 'meta_value' => '1',
305
+ 'fields' => 'ids'
306
+ ) );
307
+ foreach ( $media_library_items as $item ) {
308
+ wp_delete_attachment( $item, true );
309
+ }
310
+ echo '<p><span style="color:green">&#10004;</span> ' . sprintf( _n( '1 attachment deleted', '%s attachments deleted', count( $media_library_items ), 'video-thumbnails' ), count( $media_library_items ) ) . '</p>';
311
+
312
+ die();
313
+ } // End delete test images callback
314
+
315
  function markup_detection_test_callback() {
316
 
317
  $new_thumbnail = null;
578
 
579
  <p><?php _e( 'Also be sure to test that you can manually upload an image to your site. If you\'re unable to upload images, you may need to <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a>.', 'video-thumbnails' ); ?></p>
580
 
581
+ <p>
582
+ <input type="submit" id="test-video-thumbnail-saving-media" class="button-primary" value="<?php esc_attr_e( 'Download Test Image', 'video-thumbnails' ); ?>" />
583
+ <input type="submit" id="delete-video-thumbnail-test-images" class="button" value="<?php esc_attr_e( 'Delete Test Images', 'video-thumbnails' ); ?>" />
584
+ </p>
585
+
586
+ <div id="media-test-result"></div>
587
 
588
  <h3><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3>
589
  <table class="widefat">
php/providers/class-vimeo-thumbnails.php CHANGED
@@ -105,14 +105,14 @@ class Vimeo_Thumbnails extends Video_Thumbnails_Providers {
105
  return array(
106
  array(
107
  'markup' => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
108
- 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
109
- 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
110
  'name' => __( 'iFrame Embed', 'video-thumbnails' )
111
  ),
112
  array(
113
  'markup' => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
114
- 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
115
- 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
116
  'name' => __( 'Flash Embed', 'video-thumbnails' )
117
  ),
118
  array(
105
  return array(
106
  array(
107
  'markup' => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
108
+ 'expected' => 'http://i.vimeocdn.com/video/287850781_1280.jpg',
109
+ 'expected_hash' => '5388e0d772b827b0837444b636c9676c',
110
  'name' => __( 'iFrame Embed', 'video-thumbnails' )
111
  ),
112
  array(
113
  'markup' => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
114
+ 'expected' => 'http://i.vimeocdn.com/video/287850781_1280.jpg',
115
+ 'expected_hash' => '5388e0d772b827b0837444b636c9676c',
116
  'name' => __( 'Flash Embed', 'video-thumbnails' )
117
  ),
118
  array(
php/providers/class-vk-thumbnails.php CHANGED
@@ -63,9 +63,9 @@ class VK_Thumbnails extends Video_Thumbnails_Providers {
63
  public static function get_test_cases() {
64
  return array(
65
  array(
66
- 'markup' => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164106383&hash=0fdb5f49218be7c2&hd=1" width="607" height="360" frameborder="0"></iframe>',
67
- 'expected' => 'http://cs513416.vk.me/u157000410/video/l_73b292cc.jpg',
68
- 'expected_hash' => '6d4b086ff1a55c9b48f56bc7848e6c84',
69
  'name' => __( 'iFrame Embed', 'video-thumbnails' )
70
  ),
71
  );
63
  public static function get_test_cases() {
64
  return array(
65
  array(
66
+ 'markup' => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164108685&hash=d9a2915c4d4c2bb4&hd=3" width="607" height="360" frameborder="0"></iframe>',
67
+ 'expected' => 'http://cs518315.vk.me/u157000410/video/l_5ed29d68.jpg',
68
+ 'expected_hash' => '2d603fbec41701cf6db9b5402c1e90f0',
69
  'name' => __( 'iFrame Embed', 'video-thumbnails' )
70
  ),
71
  );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: sutherlandboswell
3
  Donate link: http://wie.ly/u/donate
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
5
  Requires at least: 3.2
6
- Tested up to: 3.8.1
7
- Stable tag: 2.7.2
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -12,7 +12,7 @@ Video Thumbnails simplifies the process of automatically displaying video thumbn
12
 
13
  Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and locate the thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types and custom fields!
14
 
15
- **New!** [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) gives you even more power. Enjoy features like maximum image sizes, more powerful bulk scanning options, a customizable upload directory, and more!
16
 
17
  Video Thumbnails currently supports these video services:
18
 
@@ -65,6 +65,10 @@ Some functions are available to advanced users who want to customize their theme
65
  1. Check the support threads to see if anyone has had the same issue.
66
  1. If you are still unable to resolve the problem, start a thread with a good descriptive title ("Error" or "No thumbnails" is a bad title) and be sure to include the results of your testing as well. Also be sure to include the name of your theme, any video plugins you're using, and any other details you can think of.
67
 
 
 
 
 
68
  = Can I get thumbnails from a specific time? =
69
 
70
  No, Video Thumbnails only uses thumbnails provided by the source. If you're posting videos from your own account, many providers allow you to choose the thumbnail.
@@ -103,10 +107,6 @@ As an alternative you could assign a class to the element and style it with CSS.
103
 
104
  Every theme is different, so this can be tricky if you aren't familiar with WordPress theme development. You need to edit your template in the appropriate place, replacing `<?php the_content(); >` with `<?php the_excerpt(); >` so that only an excerpt of the post is shown on the home page or wherever you would like to display the video thumbnail.
105
 
106
- = Why are there black bars on some YouTube thumbnails? =
107
-
108
- This is an unfortunate side effect of some old YouTube videos not having widescreen thumbnails. As of version 2.0, the plugin checks for HD thumbnails so this issue should be less common.
109
-
110
  = Why did it stop finding thumbnails for Vimeo? =
111
 
112
  The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try again after a few hours.
@@ -118,6 +118,10 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
118
 
119
  == Changelog ==
120
 
 
 
 
 
121
  = 2.7.2 =
122
  * Added support for Youku iFrame embed code
123
  * Fixed Vimeo channel URL test
3
  Donate link: http://wie.ly/u/donate
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
5
  Requires at least: 3.2
6
+ Tested up to: 3.8.2
7
+ Stable tag: 2.7.3
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
12
 
13
  Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and locate the thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types and custom fields!
14
 
15
+ **New!** [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) gives you even more power. Enjoy features like maximum image sizes, widescreen cropping, more powerful bulk scanning options, a customizable upload directory, and more!
16
 
17
  Video Thumbnails currently supports these video services:
18
 
65
  1. Check the support threads to see if anyone has had the same issue.
66
  1. If you are still unable to resolve the problem, start a thread with a good descriptive title ("Error" or "No thumbnails" is a bad title) and be sure to include the results of your testing as well. Also be sure to include the name of your theme, any video plugins you're using, and any other details you can think of.
67
 
68
+ = Why are there black bars on some YouTube thumbnails? =
69
+
70
+ Video Thumbnails uses high-resolution widescreen thumbnails whenever they are available. If a video is not in HD, a fullscreen thumbnail is used. This can result in letterboxing when the video is actually widescreen. Users of the [pro version](https://refactored.co/plugins/video-thumbnails) can select an aspect ratio in the settings if this is a constant problem. [More info](https://refactored.co/blog/remove-black-bars-youtube-thumbnails).
71
+
72
  = Can I get thumbnails from a specific time? =
73
 
74
  No, Video Thumbnails only uses thumbnails provided by the source. If you're posting videos from your own account, many providers allow you to choose the thumbnail.
107
 
108
  Every theme is different, so this can be tricky if you aren't familiar with WordPress theme development. You need to edit your template in the appropriate place, replacing `<?php the_content(); >` with `<?php the_excerpt(); >` so that only an excerpt of the post is shown on the home page or wherever you would like to display the video thumbnail.
109
 
 
 
 
 
110
  = Why did it stop finding thumbnails for Vimeo? =
111
 
112
  The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try again after a few hours.
118
 
119
  == Changelog ==
120
 
121
+ = 2.7.3 =
122
+ * Improved image download test
123
+ * Updated Vimeo and VK tests
124
+
125
  = 2.7.2 =
126
  * Added support for Youku iFrame embed code
127
  * Fixed Vimeo channel URL test
video-thumbnails.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://refactored.co/plugins/video-thumbnails
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
- Version: 2.7.2
9
  License: GPL2
10
  Text Domain: video-thumbnails
11
  Domain Path: /languages/
@@ -30,7 +30,7 @@ Domain Path: /languages/
30
 
31
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
32
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
33
- define( 'VIDEO_THUMBNAILS_VERSION', '2.7.2' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
+ Version: 2.7.3
9
  License: GPL2
10
  Text Domain: video-thumbnails
11
  Domain Path: /languages/
30
 
31
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
32
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
33
+ define( 'VIDEO_THUMBNAILS_VERSION', '2.7.3' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );