Version Description
- Fixed issue with force crop option
- Fixed issue with save to media option
- Fixed issue with return type object
Download this release
Release Info
Developer | andersthorborg |
Plugin | Advanced Custom Fields: Image Crop Add-on |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.1.1 to 1.1.2
- acf-image-crop-v5.php +8 -4
- acf-image-crop.php +1 -1
- js/input.js +1 -3
- readme.txt +6 -1
acf-image-crop-v5.php
CHANGED
@@ -282,7 +282,7 @@ class acf_field_image_crop extends acf_field_image {
|
|
282 |
'data-width' => $width,
|
283 |
'data-height' => $height,
|
284 |
'data-force_crop' => $field['force_crop'] == 'yes' ? 'true' : 'false',
|
285 |
-
'data-
|
286 |
'data-save_format' => $field['save_format'],
|
287 |
'data-preview_size' => $field['preview_size'],
|
288 |
'data-library' => $field['library']
|
@@ -803,7 +803,6 @@ class acf_field_image_crop extends acf_field_image {
|
|
803 |
if(!is_object($data)){
|
804 |
return $value;
|
805 |
}
|
806 |
-
|
807 |
$value = $data->cropped_image;
|
808 |
|
809 |
// format
|
@@ -824,6 +823,7 @@ class acf_field_image_crop extends acf_field_image {
|
|
824 |
elseif( $field['save_format'] == 'object' )
|
825 |
{
|
826 |
if(is_numeric($data->cropped_image )){
|
|
|
827 |
$attachment = get_post( $data->cropped_image );
|
828 |
// validate
|
829 |
if( !$attachment )
|
@@ -869,11 +869,15 @@ class acf_field_image_crop extends acf_field_image {
|
|
869 |
}
|
870 |
elseif(is_array( $data->cropped_image)){
|
871 |
$value = array(
|
872 |
-
'url' => $this->getAbsoluteImageUrl($data->cropped_image['image'])
|
|
|
|
|
|
|
|
|
|
|
873 |
);
|
874 |
}
|
875 |
else{
|
876 |
-
|
877 |
//echo 'ELSE';
|
878 |
}
|
879 |
|
282 |
'data-width' => $width,
|
283 |
'data-height' => $height,
|
284 |
'data-force_crop' => $field['force_crop'] == 'yes' ? 'true' : 'false',
|
285 |
+
'data-save_to_media_library' => $field['save_in_media_library'] == 'yes' ? 'true' : 'false',
|
286 |
'data-save_format' => $field['save_format'],
|
287 |
'data-preview_size' => $field['preview_size'],
|
288 |
'data-library' => $field['library']
|
803 |
if(!is_object($data)){
|
804 |
return $value;
|
805 |
}
|
|
|
806 |
$value = $data->cropped_image;
|
807 |
|
808 |
// format
|
823 |
elseif( $field['save_format'] == 'object' )
|
824 |
{
|
825 |
if(is_numeric($data->cropped_image )){
|
826 |
+
|
827 |
$attachment = get_post( $data->cropped_image );
|
828 |
// validate
|
829 |
if( !$attachment )
|
869 |
}
|
870 |
elseif(is_array( $data->cropped_image)){
|
871 |
$value = array(
|
872 |
+
'url' => $this->getAbsoluteImageUrl($data->cropped_image['image'])
|
873 |
+
);
|
874 |
+
}
|
875 |
+
elseif(is_object($data->cropped_image)){
|
876 |
+
$value = array(
|
877 |
+
'url' => $this->getAbsoluteImageUrl($data->cropped_image->image)
|
878 |
);
|
879 |
}
|
880 |
else{
|
|
|
881 |
//echo 'ELSE';
|
882 |
}
|
883 |
|
acf-image-crop.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields: Image Crop Add-on
|
4 |
Plugin URI: https://github.com/andersthorborg/ACF-Image-Crop
|
5 |
Description: An image field making it possible/required for the user to crop the selected image to the specified image size or dimensions
|
6 |
-
Version: 1.1.
|
7 |
Author: Anders Thorborg
|
8 |
Author URI: http://thorb.org
|
9 |
License: GPLv2 or later
|
3 |
Plugin Name: Advanced Custom Fields: Image Crop Add-on
|
4 |
Plugin URI: https://github.com/andersthorborg/ACF-Image-Crop
|
5 |
Description: An image field making it possible/required for the user to crop the selected image to the specified image size or dimensions
|
6 |
+
Version: 1.1.2
|
7 |
Author: Anders Thorborg
|
8 |
Author URI: http://thorb.org
|
9 |
License: GPLv2 or later
|
js/input.js
CHANGED
@@ -12,12 +12,10 @@
|
|
12 |
$field.find('.acf-image-value').data('cropped-image', originalImage);
|
13 |
$field.find('.acf-image-value').data('cropped', false);
|
14 |
$.post(ajaxurl, {action: 'acf_image_crop_get_image_size', image_id: originalImage}, function(data, textStatus, xhr) {
|
15 |
-
console.log('response', data);
|
16 |
if($field.find('img.crop-image').length == 0){
|
17 |
$field.find('.crop-action').append($('<img class="crop-image" src="#"/>'));
|
18 |
}
|
19 |
$field.find('img.crop-image').attr('src', data['url']);
|
20 |
-
console.log(data['width']);
|
21 |
$field.find('img.crop-image').data('width', data['width']);
|
22 |
$field.find('img.crop-image').data('height', data['height']);
|
23 |
var warnings = [];
|
@@ -36,7 +34,7 @@
|
|
36 |
alert('Warning: The selected image is smaller than the required size:\n' + warnings.join('\n'));
|
37 |
}
|
38 |
else{
|
39 |
-
if($options.data('
|
40 |
initCrop($field);
|
41 |
}
|
42 |
}
|
12 |
$field.find('.acf-image-value').data('cropped-image', originalImage);
|
13 |
$field.find('.acf-image-value').data('cropped', false);
|
14 |
$.post(ajaxurl, {action: 'acf_image_crop_get_image_size', image_id: originalImage}, function(data, textStatus, xhr) {
|
|
|
15 |
if($field.find('img.crop-image').length == 0){
|
16 |
$field.find('.crop-action').append($('<img class="crop-image" src="#"/>'));
|
17 |
}
|
18 |
$field.find('img.crop-image').attr('src', data['url']);
|
|
|
19 |
$field.find('img.crop-image').data('width', data['width']);
|
20 |
$field.find('img.crop-image').data('height', data['height']);
|
21 |
var warnings = [];
|
34 |
alert('Warning: The selected image is smaller than the required size:\n' + warnings.join('\n'));
|
35 |
}
|
36 |
else{
|
37 |
+
if($options.data('force_crop')){
|
38 |
initCrop($field);
|
39 |
}
|
40 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: andersthorborg
|
|
3 |
Tags: afc, advanced custom fields, image crop, image, crop
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.9.1
|
6 |
-
Stable tag: 1.1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -61,6 +61,11 @@ function my_register_fields()
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
|
|
64 |
= 1.1.1 =
|
65 |
* Removed unsued references and that caused php warnings
|
66 |
* Added a missing default value that caused a php warning
|
3 |
Tags: afc, advanced custom fields, image crop, image, crop
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.9.1
|
6 |
+
Stable tag: 1.1.2
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 1.1.2 =
|
65 |
+
* Fixed issue with force crop option
|
66 |
+
* Fixed issue with save to media option
|
67 |
+
* Fixed issue with return type object
|
68 |
+
|
69 |
= 1.1.1 =
|
70 |
* Removed unsued references and that caused php warnings
|
71 |
* Added a missing default value that caused a php warning
|