diff --git a/crop-thumbnails.php b/crop-thumbnails.php
index e8c1067..2710f3d 100644
--- a/crop-thumbnails.php
+++ b/crop-thumbnails.php
@@ -1,12 +1,12 @@
.
*/
//cpt - stands for crop-post-thumbnail
define('CROP_THUMBS_LANG','cpt_lang');
-define('CROP_THUMBS_VERSION','0.8.4');
+define('CROP_THUMBS_VERSION','0.10.0');
function cpt_plugin_init() {
load_plugin_textdomain( CROP_THUMBS_LANG, false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
-
- __('Crop your thumbnails, the easy way.');//have to be the same as the plugins-description - for automatic integration into poedit
+
+ __('Crop your thumbnails, the easy way.');//have to be the same as the plugins-description - for automatic integration into poedit
}
add_action('plugins_loaded', 'cpt_plugin_init');
@@ -46,5 +46,6 @@ function cptGetWpVersion() {
include_once(dirname(__FILE__).'/functions/settings.php');
include_once(dirname(__FILE__).'/functions/editor.php');
+include_once(dirname(__FILE__).'/functions/backendpreparer.php');
include_once(dirname(__FILE__).'/functions/save.php');
-?>
\ No newline at end of file
+?>
diff --git a/css/cpt-window.css b/css/cpt-window.css
index b5d16eb..53dabf7 100644
--- a/css/cpt-window.css
+++ b/css/cpt-window.css
@@ -16,6 +16,7 @@
.thumbnail-list li.active { background-color:#aad6f4; border:1px solid #aad6f4; }
.thumbnail-list li span { display:block; font-size:0.8em; }
.thumbnail-list li img { max-width:100%; height: auto; max-height:250px;}
+.thumbnail-list li h3 { font-size:1em; }
.thumbnail-list li .lowResWarning,
.thumbnail-list li .badParameterWarning { font-style: italic; color:#990000;}
diff --git a/css/options.css b/css/options.css
index bd71b7f..6c2c600 100644
--- a/css/options.css
+++ b/css/options.css
@@ -1,2 +1,15 @@
.cpt_settings_paypal { border:1px solid #298CBA; border-radius:3px; background-color:#f6f6f6; max-width:30em; padding:0 0.5em; margin:2em 0; text-align:center; }
-.cpt_settings_submit { margin-top:2em; }
\ No newline at end of file
+.cpt_settings_submit { margin-top:2em; }
+
+.cropThumbnailModal.ui-dialog { padding:0; border-radius: 0; border:0; }
+
+/*dialog headline*/
+.cropThumbnailModal.ui-dialog .ui-dialog-title { font-size:13px; font-family:'Open Sans', sans-serif; margin: 0; padding:0 29px 0 10px; line-height: 29px; }
+.cropThumbnailModal.ui-dialog .ui-dialog-titlebar { padding:0; border:0; height: 29px; border-bottom:1px solid #DFDFDF; border-radius: 0; }
+.cropThumbnailModal.ui-dialog .ui-button.ui-dialog-titlebar-close { width: 29px; height: 29px; margin: 0; }
+.cropThumbnailModal.ui-dialog .ui-button.ui-dialog-titlebar-close:before { line-height: 29px; }
+.cropThumbnailModal.ui-dialog .ui-dialog-titlebar-close span { display: none; }
+
+/*dialog content*/
+.cropThumbnailModal.ui-dialog .ui-dialog-content { padding:0; overflow: hidden; }
+.cropThumbnailModal.ui-dialog .ui-dialog-content iframe { width:100%; height: 100%; }
diff --git a/functions/backendpreparer.php b/functions/backendpreparer.php
new file mode 100644
index 0000000..7bb6356
--- /dev/null
+++ b/functions/backendpreparer.php
@@ -0,0 +1,268 @@
+
+
+post_mime_type,$this->allowedMime)) {
+ $html = '';
+ $html.= 'ID.',"viewmode":"single"}\' ';
+ $html.= 'title="'.esc_attr__('Crop Thumbnail',CROP_THUMBS_LANG).'">';
+ $html.= ' '.esc_html__('Crop Thumbnail',CROP_THUMBS_LANG);
+ $html.= ' ';
+
+ $form_fields['cropthumbnails'] = array(
+ 'label' => 'Crop Thumbnails ',//no i18n cause it should be obvious what plugin is used here
+ 'input' => 'html',
+ 'html' => $html
+ );
+ }
+ return $form_fields;
+ }
+}
+$cpt_postView = new CropPostThumbnailsBackendPreparer();
diff --git a/functions/editor.php b/functions/editor.php
index 8fdd363..16eb7a4 100644
--- a/functions/editor.php
+++ b/functions/editor.php
@@ -1,20 +1,20 @@
byImageId();
} else {
$failure_msg = '
'.__('No featured Image set for this post until now.',CROP_THUMBS_LANG).'
';
@@ -43,10 +43,10 @@ function ajaxWindow() {
break;
default:
$failure_msg = __('An error happend!',CROP_THUMBS_LANG);
- break;
+ break;
}
}
-
+
if(!empty($failure_msg)) {
$windowCssPath = apply_filters('crop_post_thumbnail_window_css', plugins_url('css/cpt-window.css',dirname(__FILE__)));
wp_enqueue_style( 'cpt-window',$windowCssPath,array('wp-admin'),CROP_THUMBS_VERSION);
@@ -55,7 +55,7 @@ function ajaxWindow() {
}
die();//to prevent to send back a "0"
}
-
+
/**
* Display a list of images that are attached to this post_id.
* Hightlight the post-thumbnail (if it is attached to this post_id)
@@ -63,17 +63,17 @@ function ajaxWindow() {
function listImages() {
global $cptSettings;
$options = $cptSettings->getOptions();
-
+
$data = $this->loadPostIdData(intval($_REQUEST['post_id']));
-
+
$parent_post_type = '';
$_tmp_post = get_post(intval($_REQUEST['post_id']));
if(!empty($_tmp_post)) {
$parent_post_type = $_tmp_post->post_type;
}
-
+
$cptContent = '';
-
+
if($this->shouldBeHiddenOnPostType($options,$parent_post_type)) {
$cptContent = ''.__('Cropping is disabled for this post-type.',CROP_THUMBS_LANG).'
';
} elseif($data==false) {
@@ -94,8 +94,8 @@ function listImages() {
@@ -109,7 +109,7 @@ function listImages() {
getOptions();
$this->addDebug('options', print_r($options,true));
$image_obj = get_post(intval($_REQUEST['image_id']));
-
+
//$post_id_attached holds the id of the post the image is attached to - can be null/empty
$post_id_attached = -1;
if(!empty($image_obj->post_parent)) {
- $post_id_attached=$image_obj->post_parent;
+ $post_id_attached=$image_obj->post_parent;
}
-
+
//$current_parent_post_type
$current_parent_post_type = '';
$current_parent_post_id = -1;
-
+
if(!empty($_REQUEST['parent_post_id'])) {
$_tmp = get_post(intval($_REQUEST['parent_post_id']));
if(!empty($_tmp)) {
- $current_parent_post_type = $_tmp->post_type;
+ $current_parent_post_type = $_tmp->post_type;
$current_parent_post_id = $_tmp->ID;
}
}
-
+
$all_image_sizes = $cptSettings->getImageSizes();
$this->addDebug('all_image_sizes', print_r($all_image_sizes,true));
-
+
$orig_img = wp_get_attachment_image_src($image_obj->ID, 'full');
$orig_img['gcd'] = $this->gcd($orig_img[1],$orig_img[2]);
$orig_img['ratio'] = ($orig_img[1]/$orig_img['gcd']) / ($orig_img[2]/$orig_img['gcd']);
$orig_img['print_ratio'] = ($orig_img[1]/$orig_img['gcd']).':'.($orig_img[2]/$orig_img['gcd']);
-
+
$cache_breaker = time();//a additional parameter that will be added to the image-urls to prevent the browser to show a cached image
-
+
$this->addDebug('img-postmeta',print_r(wp_get_attachment_metadata($image_obj->ID, true),true));
-
+
//the javascript
ob_start(); ?>
-
\ No newline at end of file
diff --git a/functions/settings.php b/functions/settings.php
index b10e6b5..282e111 100644
--- a/functions/settings.php
+++ b/functions/settings.php
@@ -4,7 +4,7 @@ class CropThumbnailsSettings {
private $optionsKey = 'crop-post-thumbs';
private $cssPrefix = 'cpt_settings_';
private $standardSizes = array('thumbnail','medium','large');
-
+
function __construct() {
add_action('admin_menu', array($this,'addOptionsPage'));
if(is_admin()) {
@@ -12,26 +12,26 @@ function __construct() {
add_action('admin_head', array($this,'optionsPageStyle'));
}
}
-
+
function optionsPageStyle() {
if(!empty($_REQUEST['page']) && $_REQUEST['page']=='page-cpt') {
wp_enqueue_style('crop-thumbnails-options-style',plugins_url('css/options.css',dirname(__FILE__)));
}
}
-
+
function addSettingsLinkToPluginPage($links, $file) {
- if ($file === 'crop-thumbnails/crop-thumbnails.php'){
- $settings_link = ''.__('Settings',CROP_THUMBS_LANG).' ';
- array_unshift( $links, $settings_link );
- }
- return $links;
+ if ($file === 'crop-thumbnails/crop-thumbnails.php'){
+ $settings_link = ''.__('Settings',CROP_THUMBS_LANG).' ';
+ array_unshift( $links, $settings_link );
+ }
+ return $links;
}
-
+
function addOptionsPage() {
add_options_page(__('Crop Post Thumbnail Page',CROP_THUMBS_LANG), 'Crop-Thumbnails', 'manage_options', 'page-cpt', array($this,'optionsPage'));
add_action('admin_init', array($this,'settingsInitialisation'));
}
-
+
function optionsPage() { ?>
@@ -39,12 +39,12 @@ function optionsPage() { ?>
-
+
(and let him know you love this plugin) by donating via Paypal. Thanks a lot!',CROP_THUMBS_LANG); ?>
@@ -64,10 +64,10 @@ function optionsPage() { ?>
uniqeSettingsId, $this->optionsKey, array($this,'validateSettings') );
-
+
$_sectionID = 'choose_sizes_section';
add_settings_section($_sectionID, __('Sizes and Posttypes',CROP_THUMBS_LANG), array($this,'sectionDescriptionChooseSizes'), 'page1');
add_settings_field('sizes', __('Choose the image-sizes you want to hide. Choose a post-type to prevent any use of the plugin for these entries.',CROP_THUMBS_LANG), array($this,'callback_choose_size'), 'page1', $_sectionID);
@@ -84,7 +84,7 @@ function settingsInitialisation(){
$_tmpID = 'debug_data';
add_settings_field($_tmpID, __('Enable Data-Debug.',CROP_THUMBS_LANG), array($this,'callback_'.$_tmpID), 'page1', $_sectionID, array( 'label_for' => $this->cssPrefix.$_tmpID ));
}
-
+
function sectionDescriptionChooseSizes() {?>
@@ -92,7 +92,7 @@ function sectionDescriptionChooseSizes() {?>
'.print_r($options,true).'';
$post_types = $this->getPostTypes();
$image_sizes = $this->getImageSizes();
-
+
//output
echo '';
foreach($post_types as $post_type=>$value) { ?>
@@ -111,14 +111,14 @@ function callback_choose_size() {
labels->name; ?>
- $data) :
$_checked = false;
if(!empty($options['hide_size']) && is_array($options['hide_size']) && !empty($options['hide_size'][$post_type][$thumb_name])) {
$_checked = true;
}
- if($data['crop']=='1') :
+ if($data['crop']=='1') :
?>
@@ -162,7 +162,7 @@ function callback_debug_js() {
if(empty($options[$_id])) { $options[$_id] = ''; }
echo ' ';
}
-
+
function callback_debug_data() {
$options = get_option($this->optionsKey);
$_id = 'debug_data';
@@ -172,7 +172,7 @@ function callback_debug_data() {
function validateSettings($input) {
$sizes = $this->getImageSizes();
-
+
$post_types = $this->getPostTypes();
$storeInDb = array();
@@ -184,8 +184,8 @@ function validateSettings($input) {
}
}
}
-
-
+
+
//check $input[sizes] --> are post_types correct, are sizes real there
if(!empty($input['hide_size'])) {
foreach($input['hide_size'] as $_post_type_name=>$size_type) {
@@ -198,27 +198,27 @@ function validateSettings($input) {
}
}
}
-
+
/* Experimental Section */
$_tmpID = 'allow_non_cropped';
if(!empty($input[$_tmpID])) {
$storeInDb[$_tmpID] = 1;
}
-
+
/* Advanced Section */
$_tmpID = 'debug_js';
if(!empty($input[$_tmpID])) {
$storeInDb[$_tmpID] = 1;
}
-
+
$_tmpID = 'debug_data';
if(!empty($input[$_tmpID])) {
$storeInDb[$_tmpID] = 1;
}
-
+
return $storeInDb;
}
-
+
/* helper functions **********************************************************************************************/
@@ -235,54 +235,48 @@ function getPostTypes() {
/**
- * Creates an array of all image sizes:
- * array[sizename][height]
- * array[sizename][width]
- * array[sizename][crop] = boolean
- *
- * Thanks to the ajax_thumbnail_rebuild plugin and post-thumbnail-editor
+ *
+ * Creates an array of all image sizes.
+ * @return {array} array of all image sizes
+ * array[]['height'] = int
+ * array[]['width'] = int
+ * array[]['crop'] = boolean
+ * array[]['name'] = string --> readable name if provided in "image_size_names_choose", else sizename
+ *
*/
function getImageSizes() {
global $_wp_additional_image_sizes;//array with the available image sizes
- $tmp_sizes = get_intermediate_image_sizes();
+ $tmp_sizes = array_flip(get_intermediate_image_sizes());
+ foreach($tmp_sizes as $key=>$value) {
+ $tmp_sizes[$key] = $key;
+ }
+ $tmp_sizes = apply_filters( 'image_size_names_choose', $tmp_sizes );
+
$sizes = array();
- foreach ($tmp_sizes as $s){
- //width
- if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) {// theme-added size
- $width = intval( $_wp_additional_image_sizes[$s]['width'] );
- } else { // default sizes set in options
- $width = get_option( "{$s}_size_w" );
- }
- //height
- if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) {// theme-added size
- $height = intval( $_wp_additional_image_sizes[$s]['height'] );
- } else { // default sizes set in options
- $height = get_option( "{$s}_size_h" );
- }
- //crop
- if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) {// theme-added size
- $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
- } else { // default sizes set in options
- $crop = get_option( "{$s}_crop" );
+ foreach( $tmp_sizes as $_size=>$theName ) {
+
+ if ( in_array( $_size, array( 'thumbnail', 'medium', 'large' ) ) ) {
+ $sizes[ $_size ]['width'] = intval(get_option( $_size . '_size_w' ));
+ $sizes[ $_size ]['height'] = intval(get_option( $_size . '_size_h' ));
+ $sizes[ $_size ]['crop'] = (bool) get_option( $_size . '_crop' );
+ } else {
+ $sizes[ $_size ] = array(
+ 'width' => intval($_wp_additional_image_sizes[ $_size ]['width']),
+ 'height' => intval($_wp_additional_image_sizes[ $_size ]['height']),
+ 'crop' => (bool) $_wp_additional_image_sizes[ $_size ]['crop']
+ );
}
- //join
- $sizes[$s] = array(
- 'width' => $width,
- 'height' => $height,
- 'crop' => $crop
- );
+ $sizes[ $_size ]['name'] = $theName;
}
- #print_r($sizes);
return $sizes;
}
-
+
function getOptions() {
return get_option($this->optionsKey);
}
-
+
function getNonceBase() {
return 'crop-post-thumbnails-nonce-base';
}
}
$cptSettings = new CropThumbnailsSettings();
-?>
\ No newline at end of file
diff --git a/js/cpt-crop.js b/js/cpt-crop.js
index 8d25e29..60ef8e6 100644
--- a/js/cpt-crop.js
+++ b/js/cpt-crop.js
@@ -1,25 +1,25 @@
jQuery(document).ready(function($) {
var pluginpath = '../wp-content/plugins/crop-thumbnails';
var adminAjaxPath = '../wp-admin/admin-ajax.php';
-
+
//setup for ajax connections
$.ajaxSetup({type:'POST', url:adminAjaxPath, cache:false, timeout: (30 * 1000)});
-
+
//cropping object: holds jcrop-object and image to use the crop on
var cropping = {api:-1, img : $('.selectionArea img')};
-
+
/*needed cause the js-logic is currently not handle the hidden objects in dependence with "select all of the same ratio"*/
$('.thumbnail-list li.hidden').remove();
-
+
cropping.img.fadeTo(0, 0.3);
-
+
//handle click on an entry
$('.thumbnail-list li').click(function() {
selectAllWithSameRatio($(this));
activateArea(cropping);
});
-
-
+
+
//handle checkbox for selecting all with same ratio
$('#cpt-same-ratio').change(function() {
var active = $('.thumbnail-list li.active');
@@ -35,18 +35,18 @@ jQuery(document).ready(function($) {
}
}
});
-
-
+
+
$('#cpt-deselect').click(function() {
$('.thumbnail-list li.active').removeClass('active');
deactivateArea(cropping);
});
-
-
+
+
$('#cpt-generate').click(function() {
var active = $('.thumbnail-list li.active');
if(active.length===0) {
- alert(cpt_lang['selectOne']);
+ alert(cpt_lang.selectOne);
return;
}
var selection = cropping.api.tellSelect();
@@ -54,27 +54,27 @@ jQuery(document).ready(function($) {
doProcessing(active,cropping);
}
});
-
-
+
+
$('.cpt-debug .cpt-debug-handle').click(function(e) {
e.preventDefault();
$('.cpt-debug').toggleClass('closed');
});
-
+
/********************************/
function doProcessing(active,cropping) {
/*console.log('doProcessing');*/
-
- var active_array = new Array();
+
+ var active_array = [];
active.find('img').each(function() {
active_array.push($(this).data('values'));
});
-
+
$('.mainWindow').hide();
$('.waitingWindow').show();
-
- $.ajax({
- data:{
+
+ $.ajax({
+ data:{
action: 'cptSaveThumbnail',
'_ajax_nonce': cpt_ajax_nonce,
cookie: encodeURIComponent(document.cookie),
@@ -89,13 +89,13 @@ jQuery(document).ready(function($) {
success : function( response ) {
try {
var result = JSON.parse(response);
-
- if(cpt_debug_js) {
+
+ if(cpt_debug_js) {
console.log('Save Function Debug',result.debug);
}
-
+
if(typeof result.success == "number") {
-
+
if(result.changed_image_format) {
window.location.reload();
} else {
@@ -108,11 +108,11 @@ jQuery(document).ready(function($) {
} catch(e) {
alert(e.message+"\n"+response);
}
-
+
}
});
}
-
+
function doCacheBreaker(number) {
$('.thumbnail-list li img').each(function() {
var imgurl = $(this).attr('src');
@@ -125,7 +125,7 @@ jQuery(document).ready(function($) {
$(this).attr('src',imgurl);
});
}
-
+
function selectAllWithSameRatio(elem) {
$('.thumbnail-list li').removeClass('active');
if($('#cpt-same-ratio').attr('checked')==='checked') {
@@ -136,15 +136,15 @@ jQuery(document).ready(function($) {
elem.addClass('active');
}
}
-
-
+
+
function deactivateArea(c) {
if(c.api!=-1) {
c.api.release();
c.api.disable();
}
}
-
+
function activateArea(c) {
deactivateArea(c);
var allActiveThumbs = $('.thumbnail-list li.active img');
@@ -152,8 +152,8 @@ jQuery(document).ready(function($) {
var largestHeight = 0;
var ratio = 0;
var crop = true;
-
-
+
+
//get the options
allActiveThumbs.each(function() {
var img_data = $(this).data('values');
@@ -164,13 +164,13 @@ jQuery(document).ready(function($) {
//alert(cpt_lang['bug']);
//TODO: test if this is still needed
}
-
+
//we only need to check in one dimension, cause per definition all selected images have to use the same ratio
if(img_data.width > largestWidth) {
largestWidth = img_data.width;
- largestHeight = img_data.height;
+ largestHeight = img_data.height;
}
-
+
//crop also has to be the same on all selected images
if(img_data.crop==1) {
crop = true;
@@ -185,25 +185,25 @@ jQuery(document).ready(function($) {
} else {
scale = c.img.data('values').width / largestWidth;
}
-
+
var preSelect = [ 0, 0, Math.round(scale*c.img.width()), Math.round(scale*c.img.height()) ];
var minSize = [ largestWidth, largestHeight ];
// END get the options
-
+
//set the options
- var options = {}
+ var options = {};
options.boxWidth = c.img.width();
options.boxHeight = c.img.height();
options.trueSize = [cropping.img.data('values').width,c.img.data('values').height];
options.aspectRatio = ratio;
options.setSelect = preSelect;
-
+
if(largestWidth>cropping.img.data('values').width || largestHeight>cropping.img.data('values').height) {
- alert(cpt_lang['warningOriginalToSmall']);
+ alert(cpt_lang.warningOriginalToSmall);
} else {
options.minSize = minSize;
}
-
+
//correct some options
if(ratio>=0) {
//add a offset to move the selection in the middle
@@ -213,24 +213,24 @@ jQuery(document).ready(function($) {
//no offset cause in most cases the the selection is needed in the upper corner (human portrait)
options.setSelect = [ 0, 0, Math.round(scale*c.img.width()) , cropping.img.data('values').height];
}
-
+
if(scale===Infinity) {
options.setSelect = [ 0, 0, Math.round(scale*c.img.width()) , cropping.img.data('values').height];
}
-
+
//free scaling
if(!crop) {
options.aspectRatio = false;
options.setSelect = [0,0,cropping.img.data('values').width,cropping.img.data('values').height];
console.log('free scaling');
}
-
+
//debug
- if(cpt_debug_js) {
+ if(cpt_debug_js) {
console.log('choosed image - data',c.img.data('values'));
- console.log('JCrop - options',options);
+ console.log('JCrop - options',options);
}
-
+
c.api = $.Jcrop(c.img, options);
}
-});
\ No newline at end of file
+});
diff --git a/lang/cpt_lang-de_DE.mo b/lang/cpt_lang-de_DE.mo
index 13f8717..42267a8 100644
Binary files a/lang/cpt_lang-de_DE.mo and b/lang/cpt_lang-de_DE.mo differ
diff --git a/lang/cpt_lang-de_DE.po b/lang/cpt_lang-de_DE.po
index e5b4cb4..1ed96ee 100644
--- a/lang/cpt_lang-de_DE.po
+++ b/lang/cpt_lang-de_DE.po
@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: Crop-Post-Thumbnails\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-08 00:31+0100\n"
-"PO-Revision-Date: 2013-10-08 00:33+0100\n"
+"PO-Revision-Date: 2015-09-19 17:32+0100\n"
"Last-Translator: Volkmar Kantor \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -11,7 +11,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e;esc_attr_e;esc_html_e;esc_html__\n"
"X-Poedit-Basepath: .\n"
-"X-Generator: Poedit 1.5.4\n"
+"X-Generator: Poedit 1.7.6\n"
+"Language: de_DE\n"
"X-Poedit-SearchPath-0: ..\n"
#: ../crop-thumbnails.php:34
@@ -61,7 +62,7 @@ msgid ""
"Warning: the original image is to small to be cropped in good quality with "
"this thumbnail-size."
msgstr ""
-"Warung: das Original-Bild ist zu klein um für diese Thumbnail-Größe es in "
+"Warung: das Original-Bild ist zu klein um es für diese Thumbnail-Größe in "
"guter Qualität zuzuschneiden."
#: ../functions/editor.php:182
diff --git a/readme.txt b/readme.txt
index f02e9db..967819c 100644
--- a/readme.txt
+++ b/readme.txt
@@ -3,19 +3,21 @@ Contributors: volkmar-kantor
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=volkmar%2ekantor%40gmx%2ede&lc=DE&item_name=Volkmar%20Kantor%20%2d%20totalmedial%2ede&item_number=crop%2dthumbnails&no_note=0¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
Tags: post-thumbnails, images, media library
Requires at least: 3.1
-Tested up to: 3.7.1
+Tested up to: 4.3
Stable tag: trunk
License: GPL v3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
-"Crop Thumbnails" made it easy to get exacly that specific image-detail you want to show. Crop your images the simple way.
+"Crop Thumbnails" made it easy to get exacly that specific image-detail you want to show in the automatic cropped post-thumbnails.
== Description ==
-The plugin enhance functionality to crop your thumbnails individuell and simple. It add links on backend to enter all images you had attached to a post, page or custom-post.
+The plugin enhance functionality to crop your automatic cropped post-thumbnails individuell and simple. It add links in the backend to enter all images you had attached to a post, page or custom-post.
In the Crop-Editor you can choose one or more (if they have the same ratio) imagesizes and cut-off the part of the image you want.
-It is possible to filter the list of available image-sizes (in dependency to post-types) in the settings (Settings > Crop-Thumbnails).
+Further Features
+* It is possible to filter the list of available image-sizes (in dependency to post-types) in the settings (Settings > Crop-Thumbnails).
+* You could provide your users a custom style for the Editor-Window.
== Installation ==
@@ -42,12 +44,10 @@ You can use the built in installer and upgrader, or you can install the plugin m
= I have cropped the image but the old one is used on the page. =
If you had viewed your image on the site before, your browser has cached the image. Go tell them to reload the fresh image from the server by hitting "F5".
-= I have cropped the image but in the featured-image box in the editor the croped version dont show up =
-Refresh or Update the editor page.
-Note that the image in the featured-image box will only be a preview, to show what image is choosed. The theme defines what image-size is used on the front-end.
-
= Is it possible to crop an non-cropped image-size? =
-Currently not.
+No. The purpose of this plugin is to provide control for the wordpress automatic crop. If you want to crop let's say the full-size image you should
+* a) upload it in a better format in the first place
+* OR b) use the Standard Wordpress-Image editor to crop the image.
= Is it possible to adjust the css-style of the crop-thumbnail window? =
Yes, for a simple test, copy the css/cpt-window.css file into your template_directory and make some change.
@@ -59,6 +59,24 @@ function myCustomStyle($content) {
return $content;
}`
+= Can i make the modal-dialog fullscreen? =
+Yes, i added a filter with some settings for the modal-dialog, so you can adjust the size:
+`add_filter('crop_thumbnails_modal_window_settings','crop_thumbnails_modal_window_settings_override');
+function crop_thumbnails_modal_window_settings_override($param) {
+ $param['limitToWidth'] = false; //You may set a number, then thats the maximum width the modal can be. On small screens it will be smaller (see offsets). Set to FALSE if you want no limit.
+ $param['maxWidthOffset'] = 0; //window-width minus "width_offset" equals modal-width
+ $param['maxHeightOffset'] = 0; //window-width minus "height_offset" equals modal-height
+ return $param;
+}`
+
+= I have show the cropped image in the backend in an custom meta-box. It does not update after the modal-dialog closed. Is there a way to fix this =
+Yeah, there is a way. After the crop-thumbnails-modal closed it triggeres a javascript event on the body element. You could use jQuery to cache-break your cropped thumbnail (in backend-view).
+The event called "cropThumbnailModalClosed". The plugin also provides a global function that could be called (only in post-edit-view and mediathek) to do the cache-break.
+Example-Code:
+`$('body').on('cropThumbnailModalClosed',function() {
+ CROP_THUMBNAILS_DO_CACHE_BREAK( $('.your-image-selector') );
+});`
+
== Screenshots ==
1. You have access to Crop-Thumbnails on post / page / custom-post-types.
@@ -68,6 +86,20 @@ function myCustomStyle($content) {
5. Choose what image-sizes should be hidden (for what post-types), for better usability.
== Changelog ==
+
+= 0.10.0 =
+* refactoring some parts of the code to make it more modular
+* adding a cache breaker to the backend, so in post-view and mediathek the image should be refreshed after the modal-dialog closes
+* provide a javascript-event ('cropThumbnailModalClosed') after the modal is closed (see F.A.Q. for details)
+* provide the human-readable Name of the Crop-Size (if available), using the "image_size_names_choose" filter
+* provide some size settings for the modal-dialog - via filter "crop_thumbnails_modal_window_settings"
+* mini language update
+
+= 0.9.0 =
+* add crop-thumbnail-button to the default attachement-screens so i could accessed better
+* change modal-dialog from thickbox to ui-dialog
+* fix the missing crop-thumbnail-button in the attachment-list-view
+
= 0.8.4 =
* fix a bug that may occure on some systems with xdebug enabled and low xdebug.max_nesting_level (see: http://wordpress.org/support/topic/error-when-trying-to-crop-a-certain-image)
* add dutch language (thanks to Max Gruson)
@@ -99,19 +131,19 @@ function myCustomStyle($content) {
= 0.7.2 =
* bug fix: change the way the link in the featured Image-Box is set
* languages: some adjustments
-
+
= 0.7.1 =
* add language: brazilian portuguese (pt_br)
* bug fix: fixes for the upcoming Wordpress 3.5
* bug fix: in crop editor, if an original image is larger than a single selected image-size, the predefined selection will now be on maximum possible size
-* bug fix: ensure that other plugins can´t add styles and scripts into the crop-thumbnail-iframe
+* bug fix: ensure that other plugins can´t add styles and scripts into the crop-thumbnail-iframe
= 0.7.0 =
* workflow-enhancement: change the way the plugin handled same image-ratios (faster editing and less warnings)
* the image-size with the biggest dimensions now is used for the min-boundaries (jcrop)
* if the min-boundaries (jcrop) are bigger than original image the min-boundaries turned off
-= 0.6.0 =
+= 0.6.0 =
* add a settings link in the plugin-listing
* add a support-author area in the settings
* update language files
@@ -121,4 +153,3 @@ function myCustomStyle($content) {
= 0.5.0 =
* Initial Version
-
\ No newline at end of file