Video Embed & Thumbnail Generator - Version 4.2.1

Version Description

  • October 6, 2013 =
  • Rounded offset values when generating thumbnails with FFMPEG and LIBAV for backwards compatibility with older versions of FFMPEG.
  • Added check to ensure server supports ImageMagick or GD libraries necessary to save thumbnails created in the browser.
  • Added check to avoid saving thumbnails twice.
  • Fixed saving disabled plugin settings.
  • Changed FFMPEG encoding string to double quotes for Windows compatibility.
Download this release

Release Info

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

Code changes from version 4.2 to 4.2.1

js/kgvid_video_plugin_admin.js CHANGED
@@ -785,7 +785,10 @@ function kgvid_save_plugin_settings(input_obj) {
785
 
786
  function kgvid_ajax_save() {
787
 
 
 
788
  var all_settings = jQuery('form').serialize();
 
789
 
790
  jQuery.post(ajaxurl, { action:"kgvid_save_settings", security: kgflashmediaplayersecurity, setting: save_queue[0].id, value: setting_value, all_settings: all_settings }, function(data) {
791
 
785
 
786
  function kgvid_ajax_save() {
787
 
788
+ var disabled_fields = jQuery('form :disabled'); //temporarily enable disabled fields so they can be serialized
789
+ disabled_fields.prop('disabled', false);
790
  var all_settings = jQuery('form').serialize();
791
+ disabled_fields.prop('disabled', true);
792
 
793
  jQuery.post(ajaxurl, { action:"kgvid_save_settings", security: kgflashmediaplayersecurity, setting: save_queue[0].id, value: setting_value, all_settings: all_settings }, function(data) {
794
 
readme.txt CHANGED
@@ -1,14 +1,14 @@
1
  === Video Embed & Thumbnail Generator ===
2
  Contributors: kylegilman
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
4
- Tags: video, video player, video gallery, html5, shortcode, thumbnail, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, responsive
5
  Requires at least: 3.5
6
  Tested up to: 3.7
7
- Stable tag: 4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for thumbnails and encodes.
12
 
13
  == Description ==
14
 
@@ -153,6 +153,13 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
153
 
154
  == Changelog ==
155
 
 
 
 
 
 
 
 
156
  = 4.2 - October 5, 2013 =
157
  * THUMBNAILS FOR EVERYBODY! Added in-browser thumbnail generation. Any video in the media library that can be played natively in the current browser can now be used to generate thumbnails without requiring special software on your server.
158
  * Updated shortcode to support the simplest possible implementation: [KGVID]. Without any additional information, it will automatically find and display all videos attached to the post.
1
  === Video Embed & Thumbnail Generator ===
2
  Contributors: kylegilman
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
4
+ Tags: video, video player, video gallery, html5, shortcode, thumbnail, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4
5
  Requires at least: 3.5
6
  Tested up to: 3.7
7
+ Stable tag: 4.2.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Generates thumbnails, encodes HTML5-compliant videos, and embeds locally hosted videos. Requires FFMPEG or LIBAV for encoding.
12
 
13
  == Description ==
14
 
153
 
154
  == Changelog ==
155
 
156
+ = 4.2.1 - October 6, 2013 =
157
+ * Rounded offset values when generating thumbnails with FFMPEG and LIBAV for backwards compatibility with older versions of FFMPEG.
158
+ * Added check to ensure server supports ImageMagick or GD libraries necessary to save thumbnails created in the browser.
159
+ * Added check to avoid saving thumbnails twice.
160
+ * Fixed saving disabled plugin settings.
161
+ * Changed FFMPEG encoding string to double quotes for Windows compatibility.
162
+
163
  = 4.2 - October 5, 2013 =
164
  * THUMBNAILS FOR EVERYBODY! Added in-browser thumbnail generation. Any video in the media library that can be played natively in the current browser can now be used to generate thumbnails without requiring special software on your server.
165
  * Updated shortcode to support the simplest possible implementation: [KGVID]. Without any additional information, it will automatically find and display all videos attached to the post.
video-embed-thumbnail-generator.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
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: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation">Donate</a>
6
- Version: 4.2
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
@@ -47,7 +47,7 @@ function kgvid_default_options_fn() {
47
  $upload_capable = kgvid_upload_capable();
48
 
49
  $options = array(
50
- "version"=>4.2,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
@@ -661,7 +661,7 @@ function kgvid_generate_encode_string($input, $output, $libraries, $format, $wid
661
  $input = substr_replace($input, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
662
  }
663
 
664
- $encode_string = $nice.$options['app_path']."/".$options['video_app']." -y -i '".$input."' ".$ffmpeg_options.$rate_control_flag.$rotate." -threads ".$options['threads']." '".$output."'";
665
 
666
  } //if FFMPEG is found
667
 
@@ -2131,7 +2131,7 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
2131
  if ( $options['ffmpeg_exists'] != "on" ) { $display_div = " style='display:none;'"; }
2132
 
2133
  echo "<div id='ffmpeg_sample_div'".$display_div."><p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> sample H.264 encode command:<br /><textarea id='ffmpeg_h264_sample' class='ffmpeg_sample_code code' cols='100' rows='5' wrap='soft' readonly='yes'>".$encode_string."</textarea></p>";
2134
- echo "<p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> test output:<br /><textarea id='ffmpeg_output' class='ffmpeg_sample_code code' cols='100' rows='20' wrap='soft' readonly='yes'></textarea></p></div>\n\t";
2135
  }
2136
 
2137
  //end of settings page callback functions
@@ -2514,12 +2514,23 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
2514
  $form_fields["kgflashmediaplayer-aspect"]["input"] = "hidden";
2515
  $form_fields["kgflashmediaplayer-aspect"]["value"] = $heightset/$widthset;
2516
 
 
 
2517
  $embedset = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
2518
  if ($embedset == "") {
2519
  $embedset = "Single Video";
2520
  update_post_meta($post->ID, '_kgflashmediaplayer-embed', $embedset); //make sure at least this value is set before attachment is inserted into post
2521
  }
2522
 
 
 
 
 
 
 
 
 
 
2523
  $thumbnail_url = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
2524
 
2525
  $uploads = wp_upload_dir();
@@ -2542,9 +2553,19 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
2542
  if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
2543
  if ( empty($numberofthumbs_value) ) { $numberofthumbs_value = $options['generate_thumbs']; }
2544
 
 
 
 
 
 
 
 
 
2545
  if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
2546
  kgvid_check_ffmpeg_exists($options, true);
2547
  }
 
 
2548
 
2549
  $randomizechecked = get_post_meta($post->ID, "_kgflashmediaplayer-randomize", true);
2550
  $forcefirstchecked = get_post_meta($post->ID, "_kgflashmediaplayer-forcefirst", true);
@@ -2554,18 +2575,6 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
2554
  if ( $featuredchecked == "on" ) { $featuredchecked = "checked"; }
2555
  else { $featuredchecked = ""; }
2556
 
2557
- if ( $options['ffmpeg_exists'] == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="'.strtoupper($options['video_app']).' not found at '.$options['app_path'].'"'; }
2558
- else { $ffmpeg_disabled_text = ""; }
2559
-
2560
- $nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
2561
-
2562
- $starts = intval(get_post_meta($post->ID, "_kgflashmediaplayer-starts", true));
2563
- $completeviews = intval(get_post_meta($post->ID, "_kgflashmediaplayer-completeviews", true));
2564
-
2565
- $form_fields["views"]["label"] = __("Video Stats");
2566
- $form_fields["views"]["input"] = "html";
2567
- $form_fields["views"]["html"] = $starts." Starts, ".$completeviews." Complete Views";
2568
-
2569
  $update_script = "";
2570
  $created_time = time()-get_post_time('U', true, $post->ID);
2571
  if ( $created_time < 60 && ($options['auto_encode'] == "on" || $options['auto_thumb'] == "on") ) {
@@ -2611,22 +2620,23 @@ display: inline-block;">Loading thumbnail...</span></div>'; }
2611
  if ( $encodevideo_info[$name."_exists"] ) { $sources[$name] = '<source src="'.$encodevideo_info[$name."url"].'" type="video/'.$type.'">'; }
2612
  }
2613
 
2614
- $choose_from_video_content = '<div style="display:none;" class="kgvid_thumbnail_box kgvid-tabs-content" id="thumb-video-'.$post->ID.'-container">
2615
- <div class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_thumb_video('.$post->ID.')" id="show-thumb-video-'.$post->ID.'"><span class="kgvid-right-arrow"></span><span class="kgvid-show-video">Choose from video...</span></div>
2616
- <div style="display:none;" id="thumb-video-'.$post->ID.'-player">
2617
- <video preload="metadata" class="kgvid-thumb-video" width="200" data-allowed="'.$options['browser_thumbnails'].'" onloadedmetadata="kgvid_thumb_video_loaded(\''.$post->ID.'\');" id="thumb-video-'.$post->ID.'" controls>'.
2618
- implode("\n", $sources).'
2619
- </video>
2620
- <div class="kgvid-video-controls">
2621
- <div class="kgvid-play-pause"></div>
2622
- <div class="kgvid-seek-bar">
2623
- <div class="kgvid-play-progress"></div>
2624
- <div class="kgvid-seek-handle"></div></div>
 
 
 
2625
  </div>
2626
- <span id="manual-thumbnail" class="button-secondary" onclick="kgvid_thumb_video_manual('.$post->ID.');">Use this frame</span>
2627
- </div>
2628
- </div>';
2629
-
2630
  $generate_content = '<div id="generate-thumb-'.$post->ID.'-container" class="kgvid-tabs-content">
2631
  <input id="attachments-'. $post->ID .'-numberofthumbs" name="attachments['.$post->ID.'][kgflashmediaplayer-numberofthumbs]" type="text" value="'.$numberofthumbs_value.'" maxlength="2" style="width:35px;text-align:center;" onchange="kgvid_disable_thumb_buttons(\''.$post->ID.'\', \'onchange\');document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" '.$ffmpeg_disabled_text.'/>
2632
  <input type="button" id="attachments-'. $post->ID .'-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb('. $post->ID .', \'generate\');" '.$ffmpeg_disabled_text.'/>
@@ -2991,7 +3001,10 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
2991
  // $attachment part of the form $_POST ($_POST[attachments][postID])
2992
  // $post attachments wp post array - will be saved after returned
2993
  // $post['post_type'] == 'attachment'
2994
- if( !empty($post['ID']) ) {
 
 
 
2995
  $thumb_id = "";
2996
  if( isset($attachment['kgflashmediaplayer-poster']) ) {
2997
 
@@ -3012,7 +3025,18 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
3012
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', ""); }
3013
  if( isset($attachment['kgflashmediaplayer-featured']) ) {
3014
  update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
3015
- if ( !empty($thumb_id) && array_key_exists('post_parent', $post) ) { set_post_thumbnail($post['post_parent'], $thumb_id); }
 
 
 
 
 
 
 
 
 
 
 
3016
  }
3017
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-featured', "notchecked"); }
3018
  if( isset($attachment['thumbtime']) ) {update_post_meta($post['ID'], '_kgflashmediaplayer-thumbtime', $attachment['thumbtime']); }
@@ -3043,16 +3067,17 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
3043
  if( isset($attachment['kgflashmediaplayer-gallery_id']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_id', $attachment['kgflashmediaplayer-gallery_id']); }
3044
 
3045
  }
 
3046
  return $post;
3047
  }
3048
  add_filter("attachment_fields_to_save", "kgvid_video_attachment_fields_to_save", null, 2);
3049
 
3050
- function kgvid_sync_thumbnail_with_featured ( $meta_id, $post_id, $meta_key, $meta_value ) {
3051
 
3052
  if ( $meta_key == "_kgflashmediaplayer-poster-id" ) { set_post_thumbnail($post_id, $meta_value); }
3053
 
3054
  }
3055
- add_action( 'updated_post_meta', 'kgvid_sync_thumbnail_with_featured', 10, 4 );
3056
 
3057
  class kgInsertMedia {
3058
  //class constructor
@@ -3458,7 +3483,7 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
3458
  $moviefilepath = substr_replace($moviefilepath, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
3459
  }
3460
 
3461
- $ffmpeg_options = '-y -ss '.$movieoffset.' -i "'.$moviefilepath.'"'.$movie_info['rotate'].' -qscale 1 -vframes 1 -f mjpeg "'.$thumbnailfilename[$i].'"';
3462
  $thumbnailurl = $thumbnailfilebase."_thumb".round($movieoffset).'.jpg';
3463
  $thumbnailurl = str_replace(" ", "_", $thumbnailurl);
3464
 
2
  /*
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: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation">Donate</a>
6
+ Version: 4.2.1
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
47
  $upload_capable = kgvid_upload_capable();
48
 
49
  $options = array(
50
+ "version"=>4.21,
51
  "embed_method"=>"Video.js",
52
  "template"=>false,
53
  "template_gentle"=>"on",
661
  $input = substr_replace($input, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
662
  }
663
 
664
+ $encode_string = $nice.$options['app_path']."/".$options['video_app'].' -y -i "'.$input.'" '.$ffmpeg_options.$rate_control_flag.$rotate." -threads ".$options['threads'].' "'.$output.'"';
665
 
666
  } //if FFMPEG is found
667
 
2131
  if ( $options['ffmpeg_exists'] != "on" ) { $display_div = " style='display:none;'"; }
2132
 
2133
  echo "<div id='ffmpeg_sample_div'".$display_div."><p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> sample H.264 encode command:<br /><textarea id='ffmpeg_h264_sample' class='ffmpeg_sample_code code' cols='100' rows='5' wrap='soft' readonly='yes'>".$encode_string."</textarea></p>";
2134
+ echo "<p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> test output:<br /><textarea id='ffmpeg_output' class='ffmpeg_sample_code code' cols='100' rows='20' wrap='soft' readonly='yes'></textarea><br>If everything is working correctly, this should end with several lines that start with <code>[libx264</code>.<br>For help interpreting this output, <a href='https://github.com/kylegilman/video-embed-thumbnail-generator/wiki/Interpreting-FFMPEG-or-LIBAV-messages'>try our Wiki page on Github</a>.</p></div>\n\t";
2135
  }
2136
 
2137
  //end of settings page callback functions
2514
  $form_fields["kgflashmediaplayer-aspect"]["input"] = "hidden";
2515
  $form_fields["kgflashmediaplayer-aspect"]["value"] = $heightset/$widthset;
2516
 
2517
+ $nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
2518
+
2519
  $embedset = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
2520
  if ($embedset == "") {
2521
  $embedset = "Single Video";
2522
  update_post_meta($post->ID, '_kgflashmediaplayer-embed', $embedset); //make sure at least this value is set before attachment is inserted into post
2523
  }
2524
 
2525
+ $starts = intval(get_post_meta($post->ID, "_kgflashmediaplayer-starts", true));
2526
+ $completeviews = intval(get_post_meta($post->ID, "_kgflashmediaplayer-completeviews", true));
2527
+
2528
+ $form_fields["views"]["label"] = __("Video Stats");
2529
+ $form_fields["views"]["input"] = "html";
2530
+ $form_fields["views"]["html"] = $starts." Starts, ".$completeviews." Complete Views";
2531
+
2532
+ // ** Thumbnail section **//
2533
+
2534
  $thumbnail_url = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
2535
 
2536
  $uploads = wp_upload_dir();
2553
  if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
2554
  if ( empty($numberofthumbs_value) ) { $numberofthumbs_value = $options['generate_thumbs']; }
2555
 
2556
+ $args = array(
2557
+ 'mime_type' => 'image/jpeg',
2558
+ 'methods' => array(
2559
+ 'save'
2560
+ )
2561
+ );
2562
+ $img_editor_works = wp_image_editor_supports($args);
2563
+
2564
  if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
2565
  kgvid_check_ffmpeg_exists($options, true);
2566
  }
2567
+ if ( $options['ffmpeg_exists'] == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="'.strtoupper($options['video_app']).' not found at '.$options['app_path'].' and server doesn\'t support ImageMagick or GD"'; }
2568
+ else { $ffmpeg_disabled_text = ""; }
2569
 
2570
  $randomizechecked = get_post_meta($post->ID, "_kgflashmediaplayer-randomize", true);
2571
  $forcefirstchecked = get_post_meta($post->ID, "_kgflashmediaplayer-forcefirst", true);
2575
  if ( $featuredchecked == "on" ) { $featuredchecked = "checked"; }
2576
  else { $featuredchecked = ""; }
2577
 
 
 
 
 
 
 
 
 
 
 
 
 
2578
  $update_script = "";
2579
  $created_time = time()-get_post_time('U', true, $post->ID);
2580
  if ( $created_time < 60 && ($options['auto_encode'] == "on" || $options['auto_thumb'] == "on") ) {
2620
  if ( $encodevideo_info[$name."_exists"] ) { $sources[$name] = '<source src="'.$encodevideo_info[$name."url"].'" type="video/'.$type.'">'; }
2621
  }
2622
 
2623
+ if ( $img_editor_works ) {
2624
+ $choose_from_video_content = '<div style="display:none;" class="kgvid_thumbnail_box kgvid-tabs-content" id="thumb-video-'.$post->ID.'-container">
2625
+ <div class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_thumb_video('.$post->ID.')" id="show-thumb-video-'.$post->ID.'"><span class="kgvid-right-arrow"></span><span class="kgvid-show-video">Choose from video...</span></div>
2626
+ <div style="display:none;" id="thumb-video-'.$post->ID.'-player">
2627
+ <video preload="metadata" class="kgvid-thumb-video" width="200" data-allowed="'.$options['browser_thumbnails'].'" onloadedmetadata="kgvid_thumb_video_loaded(\''.$post->ID.'\');" id="thumb-video-'.$post->ID.'" controls>'.
2628
+ implode("\n", $sources).'
2629
+ </video>
2630
+ <div class="kgvid-video-controls">
2631
+ <div class="kgvid-play-pause"></div>
2632
+ <div class="kgvid-seek-bar">
2633
+ <div class="kgvid-play-progress"></div>
2634
+ <div class="kgvid-seek-handle"></div></div>
2635
+ </div>
2636
+ <span id="manual-thumbnail" class="button-secondary" onclick="kgvid_thumb_video_manual('.$post->ID.');">Use this frame</span>
2637
  </div>
2638
+ </div>';
2639
+ }
 
 
2640
  $generate_content = '<div id="generate-thumb-'.$post->ID.'-container" class="kgvid-tabs-content">
2641
  <input id="attachments-'. $post->ID .'-numberofthumbs" name="attachments['.$post->ID.'][kgflashmediaplayer-numberofthumbs]" type="text" value="'.$numberofthumbs_value.'" maxlength="2" style="width:35px;text-align:center;" onchange="kgvid_disable_thumb_buttons(\''.$post->ID.'\', \'onchange\');document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" '.$ffmpeg_disabled_text.'/>
2642
  <input type="button" id="attachments-'. $post->ID .'-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb('. $post->ID .', \'generate\');" '.$ffmpeg_disabled_text.'/>
3001
  // $attachment part of the form $_POST ($_POST[attachments][postID])
3002
  // $post attachments wp post array - will be saved after returned
3003
  // $post['post_type'] == 'attachment'
3004
+ static $flag = 0;
3005
+
3006
+ if( !empty($post['ID']) && $flag < 1 ) {
3007
+
3008
  $thumb_id = "";
3009
  if( isset($attachment['kgflashmediaplayer-poster']) ) {
3010
 
3025
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', ""); }
3026
  if( isset($attachment['kgflashmediaplayer-featured']) ) {
3027
  update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
3028
+ if ( !empty($thumb_id) ) {
3029
+ if ( isset($_POST['action']) && $_POST['action'] == 'save-attachment-compat' && isset($_POST['post_id']) ) { //if this is in the media modal
3030
+ $post_parent = $_POST['post_id'];
3031
+ }
3032
+ elseif ( array_key_exists('post_parent', $post) ) {
3033
+ $post_parent = $post['post_parent'];
3034
+ }
3035
+
3036
+ if ( isset($post_parent) ) {
3037
+ set_post_thumbnail($post_parent, $thumb_id);
3038
+ }
3039
+ }
3040
  }
3041
  else { update_post_meta($post['ID'], '_kgflashmediaplayer-featured', "notchecked"); }
3042
  if( isset($attachment['thumbtime']) ) {update_post_meta($post['ID'], '_kgflashmediaplayer-thumbtime', $attachment['thumbtime']); }
3067
  if( isset($attachment['kgflashmediaplayer-gallery_id']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_id', $attachment['kgflashmediaplayer-gallery_id']); }
3068
 
3069
  }
3070
+ $flag++;
3071
  return $post;
3072
  }
3073
  add_filter("attachment_fields_to_save", "kgvid_video_attachment_fields_to_save", null, 2);
3074
 
3075
+ /* function kgvid_sync_thumbnail_with_featured ( $meta_id, $post_id, $meta_key, $meta_value ) {
3076
 
3077
  if ( $meta_key == "_kgflashmediaplayer-poster-id" ) { set_post_thumbnail($post_id, $meta_value); }
3078
 
3079
  }
3080
+ add_action( 'updated_post_meta', 'kgvid_sync_thumbnail_with_featured', 10, 4 ); */
3081
 
3082
  class kgInsertMedia {
3083
  //class constructor
3483
  $moviefilepath = substr_replace($moviefilepath, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
3484
  }
3485
 
3486
+ $ffmpeg_options = '-y -ss '.round($movieoffset).' -i "'.$moviefilepath.'"'.$movie_info['rotate'].' -qscale 1 -vframes 1 -f mjpeg "'.$thumbnailfilename[$i].'"';
3487
  $thumbnailurl = $thumbnailfilebase."_thumb".round($movieoffset).'.jpg';
3488
  $thumbnailurl = str_replace(" ", "_", $thumbnailurl);
3489