Changeset 2451574
- Timestamp:
- 01/07/2021 12:12:11 AM (5 years ago)
- Location:
- template-kit-export/trunk
- Files:
-
- 7 edited
-
README.txt (modified) (2 diffs)
-
admin/assets/js/template-kit-export-admin.js (modified) (1 diff)
-
admin/assets/js/template-kit-export-admin.min.js (modified) (1 diff)
-
admin/class-template-kit-export-admin.php (modified) (2 diffs)
-
builders/class-template-kit-export-builders-base.php (modified) (1 diff)
-
languages/template-kit-export.pot (modified) (2 diffs)
-
template-kit-export.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
template-kit-export/trunk/README.txt
r2414939 r2451574 5 5 Tested up to: 5.5 6 6 Requires PHP: 5.6 7 Stable tag: 1.0.1 77 Stable tag: 1.0.18 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 38 38 39 39 == Changelog == 40 41 = 1.0.18 - 2020-12-24 = 42 * Fix: Default thumbnail cropping + size fixes 40 43 41 44 = 1.0.17 - 2020-11-09 = -
template-kit-export/trunk/admin/assets/js/template-kit-export-admin.js
r2228221 r2451574 94 94 var uploaded_img_meta = file_frame.state().get( 'selection' ).first().toJSON(); 95 95 var thumbnail_url = ''; 96 if ( ! uploaded_img_meta['sizes']['tk_preview']) { 96 var thumbnailWidth = parseInt( window.template_kit_export.thumbnail_width ); 97 var minimumValidThumbnailWidth = 300 98 if ( ! uploaded_img_meta['sizes']['tk_preview'] || uploaded_img_meta['sizes']['tk_preview']['width'] < minimumValidThumbnailWidth) { 97 99 // The user is choosing a screenshot image that doesn't have our required thumbnail size. 98 // This either means the image is <= 600px wide already, or they've chosen an old image from the library100 // This either means the image is <= thumbnailWidth px wide already, or they've chosen an old image from the library 99 101 // that doesn't have a thumbnail generated. 100 if (uploaded_img_meta['sizes']['full'] && uploaded_img_meta['sizes']['full']['width'] <= 600) {101 // The user has uploaded an image that is <= 600px so we can use that as the thumb.102 if (uploaded_img_meta['sizes']['full'] && uploaded_img_meta['sizes']['full']['width'] <= thumbnailWidth) { 103 // The user has uploaded an image that is <= thumbnailWidth px so we can use that as the thumb. 102 104 thumbnail_url = uploaded_img_meta['sizes']['full']['url']; 103 105 } else { 104 // The user has chosen an older image from the media library that doesn't yet have a 600px thumb106 // The user has chosen an older image from the media library that doesn't yet have a thumbnailWidth px thumb 105 107 // Ask them to re-upload. 106 alert( 'Sorry the selected image does not have a correct thumbnail size. Please upload a new screenshot image or regenerate thumbnails.' );108 alert( 'Sorry the selected image does not have a correct thumbnail size. Please upload a new screenshot image that is at least ' + thumbnailWidth + ' pixels wide.' ); 107 109 return; 108 110 } 109 111 } else { 110 // The user has uploaded an image and we've managed to make a 600px wide thumbnail successfully.112 // The user has uploaded an image and we've managed to make a thumbnailWidth px wide thumbnail successfully. 111 113 thumbnail_url = uploaded_img_meta['sizes']['tk_preview']['url']; 112 114 } -
template-kit-export/trunk/admin/assets/js/template-kit-export-admin.min.js
r2225085 r2451574 1 !function(l){"use strict";function i(){var e=0;l("#template-kit-sortable-container .templates").each(function(){l(this).find(".position_id").val(e),e++})}l(function(){var e=l("#template-kit-sortable-container");0<e.length&&(i(),e.sortable(),e.on("sortstop",function(e,t){i()}))}),l(document).on("click",".upload-image",function(e){e.preventDefault();var i=l(this).parents(".templates").first().data("template-id"),a=wp.media.frames.file_frame=wp.media({title:"Select or upload image",library:{type:"image"},button:{text:"Select"},multiple:!1});a.on("select",function(){var e=a.state().get("selection").first().toJSON(),t="";if(e.sizes.tk_preview)t=e.sizes.tk_preview.url;else{if(!(e.sizes.full&&e.sizes.full.width<=600))return void alert("Sorry the selected image does not have a correct thumbnail size. Please upload a new screenshot image or regenerate thumbnails.");t=e.sizes.full.url}l("div[data-template-id="+i+"]").find(".tk-preview-image-id").val(e.id),l("div[data-template-id="+i+"] .screenshot").css("backgroundImage","url( "+t+")")}),a.open()})}(jQuery);1 !function(l){"use strict";function i(){var e=0;l("#template-kit-sortable-container .templates").each(function(){l(this).find(".position_id").val(e),e++})}l(function(){var e=l("#template-kit-sortable-container");0<e.length&&(i(),e.sortable(),e.on("sortstop",function(e,t){i()}))}),l(document).on("click",".upload-image",function(e){e.preventDefault();var a=l(this).parents(".templates").first().data("template-id"),s=wp.media.frames.file_frame=wp.media({title:"Select or upload image",library:{type:"image"},button:{text:"Select"},multiple:!1});s.on("select",function(){var e=s.state().get("selection").first().toJSON(),t="",i=parseInt(window.template_kit_export.thumbnail_width);if(!e.sizes.tk_preview||e.sizes.tk_preview.width<300){if(!(e.sizes.full&&e.sizes.full.width<=i))return void alert("Sorry the selected image does not have a correct thumbnail size. Please upload a new screenshot image that is at least "+i+" pixels wide.");t=e.sizes.full.url}else t=e.sizes.tk_preview.url;l("div[data-template-id="+a+"]").find(".tk-preview-image-id").val(e.id),l("div[data-template-id="+a+"] .screenshot").css("backgroundImage","url( "+t+")")}),s.open()})}(jQuery); -
template-kit-export/trunk/admin/class-template-kit-export-admin.php
r2414939 r2451574 92 92 public function enqueue_scripts() { 93 93 94 /** 95 * This function is provided for demonstration purposes only. 96 * 97 * An instance of this class should be passed to the run() function 98 * defined in Template_Kit_Export_Loader as all of the hooks are defined 99 * in that particular class. 100 * 101 * The Template_Kit_Export_Loader will then create the relationship 102 * between the defined hooks and the functions defined in this 103 * class. 104 */ 105 106 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'assets/js/template-kit-export-admin.min.js', array( 'jquery' ), $this->version, false ); 94 wp_register_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'assets/js/template-kit-export-admin.min.js', array( 'jquery' ), $this->version, false ); 95 wp_localize_script( $this->plugin_name, 'template_kit_export', [ 96 'thumbnail_width' => TEMPLATE_KIT_EXPORT_THUMBNAIL_WIDTH 97 ]); 98 wp_enqueue_script( $this->plugin_name ); 107 99 108 100 } … … 170 162 */ 171 163 public function register_media_size() { 172 add_image_size( 'tk_preview', 600);164 add_image_size( 'tk_preview', TEMPLATE_KIT_EXPORT_THUMBNAIL_WIDTH ); 173 165 } 174 166 -
template-kit-export/trunk/builders/class-template-kit-export-builders-base.php
r2414939 r2451574 423 423 $check_tk_preview = image_get_intermediate_size( $get_thumb_id, 'tk_preview' ); 424 424 if ( ! $check_tk_preview ) { 425 $generated_tk_preview = image_make_intermediate_size( get_attached_file( $get_thumb_id ), 600, 600, true );425 $generated_tk_preview = image_make_intermediate_size( get_attached_file( $get_thumb_id ), TEMPLATE_KIT_EXPORT_THUMBNAIL_WIDTH, 0, true ); 426 426 $template_attachment_meta = wp_get_attachment_metadata( $get_thumb_id ); 427 427 $template_attachment_meta['sizes']['tk_preview'] = $generated_tk_preview; -
template-kit-export/trunk/languages/template-kit-export.pot
r2386067 r2451574 1 # Copyright (C) 202 0template-kit-export1 # Copyright (C) 2021 template-kit-export 2 2 # This file is distributed under the same license as the template-kit-export package. 3 3 msgid "" … … 17 17 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 18 18 19 #: admin/class-template-kit-export-admin.php:12 919 #: admin/class-template-kit-export-admin.php:121 20 20 msgid "Template Kits" 21 21 msgstr "" 22 22 23 #: admin/class-template-kit-export-admin.php:1 3023 #: admin/class-template-kit-export-admin.php:122 24 24 msgid "Template Kit" 25 25 msgstr "" 26 26 27 #: admin/class-template-kit-export-admin.php:1 40, admin/class-template-kit-export-admin.php:14127 #: admin/class-template-kit-export-admin.php:132, admin/class-template-kit-export-admin.php:133 28 28 msgid "Export" 29 29 msgstr "" 30 30 31 #: admin/class-template-kit-export-admin.php:14 9, admin/class-template-kit-export-admin.php:150, includes/class-template-kit-export-cpt.php:41, includes/class-template-kit-export-cpt.php:43, includes/class-template-kit-export-cpt.php:5731 #: admin/class-template-kit-export-admin.php:141, admin/class-template-kit-export-admin.php:142, includes/class-template-kit-export-cpt.php:41, includes/class-template-kit-export-cpt.php:43, includes/class-template-kit-export-cpt.php:57 32 32 msgid "Templates" 33 33 msgstr "" -
template-kit-export/trunk/template-kit-export.php
r2414939 r2451574 3 3 * Plugin Name: Template Kit Export 4 4 * Description: Use this plugin to export Template Kits for Elementor. 5 * Version: 1.0.1 75 * Version: 1.0.18 6 6 * Author: Envato 7 7 * Author URI: https://envato.com … … 19 19 * Currently plugin version. 20 20 */ 21 define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0.17' ); 21 define( 'TEMPLATE_KIT_EXPORT_VERSION', '1.0.18' ); 22 23 /** 24 * Default generated thumbnail width. 25 */ 26 define( 'TEMPLATE_KIT_EXPORT_THUMBNAIL_WIDTH', 800 ); 22 27 23 28 /**
Note: See TracChangeset
for help on using the changeset viewer.