Video Embed & Thumbnail Generator - Version 1.0.5

Version Description

  • November 6, 2011 =
  • Fixed "Embed from URL" thumbnail creation. Generated thumbnails don't disappear anymore.
Download this release

Release Info

Developer kylegilman
Plugin Icon 128x128 Video Embed & Thumbnail Generator
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

kg_callffmpeg.php CHANGED
@@ -295,15 +295,18 @@ if ($action == delete) {
295
296
if ($action == submit) {
297
298
- $posterfile = pathinfo($poster, PATHINFO_BASENAME);
299
- $tmp_posterpath = $uploads["path"].'/thumb_tmp/'.$posterfile;
300
- $final_posterpath = $uploads["path"].'/'.$posterfile;
301
- if ( is_file($tmp_posterpath) ) { copy($tmp_posterpath, $final_posterpath); }
302
-
303
- $thumb_base = substr($tmp_posterpath, 0, -5);
304
- foreach (glob($thumb_base."?.jpg") as $thumbfilename) {
305
- unlink($thumbfilename);
306
- }
307
308
//$arr = array ( "posterfile"=>$posterfile, "tmp_posterpath"=>$tmp_posterpath, "final_posterpath"=>$final_posterpath );
309
//echo json_encode($arr);
295
296
if ($action == submit) {
297
298
+ $posterfile = pathinfo($poster, PATHINFO_BASENAME);
299
+ $tmp_posterpath = $uploads['path'].'/thumb_tmp/'.$posterfile;
300
+ if ( !is_file($uploads['path'].'/'.$posterfile) ) {
301
+ if ( is_file($tmp_posterpath) ) {
302
+ copy($tmp_posterpath, $uploads['path'].'/'.$posterfile);
303
+ $thumb_base = substr($tmp_posterpath, 0, -5);
304
+ foreach (glob($thumb_base."?.jpg") as $thumbfilename) {
305
+ unlink($thumbfilename);
306
+ }
307
+ }
308
+ if ( is_dir($uploads['path'].'/thumb_tmp') && ($files = @scandir($uploads['path'].'/thumb_tmp') && (count($files) < 2)) ) { rmdir($uploads['path'].'/thumb_tmp'); }
309
+ }
310
311
//$arr = array ( "posterfile"=>$posterfile, "tmp_posterpath"=>$tmp_posterpath, "final_posterpath"=>$final_posterpath );
312
//echo json_encode($arr);
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: kylegilman
3
Tags: video, html5, shortcode, thumbnail, ffmpeg
4
Requires at least: 3.0
5
Tested up to: 3.3
6
- Stable tag: 1.0.4
7
8
Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
9
@@ -85,6 +85,9 @@ Some of it will work without FFMPEG. You can generate embed codes for your video
85
86
== Changelog ==
87
88
= 1.0.4 - November 4, 2011 =
89
* More thorough check made for existing attachments before registering poster images with the Wordpress Media Library. Avoids registering duplicates or medium/small/thumb image sizes if they're used as poster image.
90
* Added loop, autoplay, and controls options to HTML5 video elements.
3
Tags: video, html5, shortcode, thumbnail, ffmpeg
4
Requires at least: 3.0
5
Tested up to: 3.3
6
+ Stable tag: 1.0.5
7
8
Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
9
85
86
== Changelog ==
87
88
+ = 1.0.5 - November 6, 2011 =
89
+ * Fixed "Embed from URL" thumbnail creation. Generated thumbnails don't disappear anymore.
90
+
91
= 1.0.4 - November 4, 2011 =
92
* More thorough check made for existing attachments before registering poster images with the Wordpress Media Library. Avoids registering duplicates or medium/small/thumb image sizes if they're used as poster image.
93
* Added loop, autoplay, and controls options to HTML5 video elements.
video-embed-thumbnail-generator.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Video Embed & Thumbnail Generator
4
Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
Description: Generate video thumbnails, HTML5-compliant videos, and video embed shortcodes. Some functions require FFMPEG.
6
- Version: 1.0.4
7
Author: Kyle Gilman
8
Author URI: http://www.kylegilman.net/
9
@@ -949,7 +949,7 @@ add_action('save_post', 'kg_addPostSave');
949
unlink($thumbfilename);
950
}
951
}
952
- if ( is_dir($uploads['path'].'/thumb_tmp') ) { rmdir($uploads['path'].'/thumb_tmp'); }
953
}
954
update_post_meta($post['ID'], '_kgflashmediaplayer-poster', $attachment['kgflashmediaplayer-poster']);
955
}
@@ -1009,7 +1009,7 @@ $kgIM = new kgInsertMedia();
1009
//add_filter('video_send_to_editor_url', 'kg_filter_video_url', 20, 3);
1010
1011
//function kg_filter_video_url($html, $href, $title) { //when inserting via URL only
1012
- $html = '[FMP]'.$href.'"[/FMP]';
1013
// return $html;
1014
//}
1015
@@ -1068,7 +1068,7 @@ media_upload_header();
1068
<tr class="submit">
1069
<td></td>
1070
<td>
1071
- <input type="submit" onclick="kg_generate_thumb('singleurl', 'submit'); kg_insert_shortcode();" name="insertonlybutton" id="insertonlybutton" class="button" value="Insert into Post" />
1072
</td>
1073
</tr>
1074
</tbody></table>
3
Plugin Name: Video Embed & Thumbnail Generator
4
Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
Description: Generate video thumbnails, HTML5-compliant videos, and video embed shortcodes. Some functions require FFMPEG.
6
+ Version: 1.0.5
7
Author: Kyle Gilman
8
Author URI: http://www.kylegilman.net/
9
949
unlink($thumbfilename);
950
}
951
}
952
+ if ( is_dir($uploads['path'].'/thumb_tmp') && ($files = @scandir($uploads['path'].'/thumb_tmp') && (count($files) < 2)) ) { rmdir($uploads['path'].'/thumb_tmp'); }
953
}
954
update_post_meta($post['ID'], '_kgflashmediaplayer-poster', $attachment['kgflashmediaplayer-poster']);
955
}
1009
//add_filter('video_send_to_editor_url', 'kg_filter_video_url', 20, 3);
1010
1011
//function kg_filter_video_url($html, $href, $title) { //when inserting via URL only
1012
+ // $html = '[FMP]'.$href.'"[/FMP]';
1013
// return $html;
1014
//}
1015
1068
<tr class="submit">
1069
<td></td>
1070
<td>
1071
+ <input type="button" onclick="kg_insert_shortcode();" name="insertonlybutton" id="insertonlybutton" class="button" value="Insert into Post" />
1072
</td>
1073
</tr>
1074
</tbody></table>