Manual Image Crop - Version 1.02

Version Description

-Fixed HTTP Authentication no preview issue -Fixed path issues on multisite/subfolder WP installations

Download this release

Release Info

Developer tomasz.sita
Plugin Icon 128x128 Manual Image Crop
Version 1.02
Comparing to
See all releases

Code changes from version 1.01 to 1.02

lib/ManualImageCrop.php CHANGED
@@ -132,21 +132,23 @@ setInterval(function() {
132
  */
133
  public function cropImage() {
134
  global $_wp_additional_image_sizes;
 
 
135
 
136
  $src_file_url = wp_get_attachment_image_src($_POST['attachmentId'], 'full');
137
  if (!$src_file_url) {
138
  echo json_encode (array('status' => 'error', 'message' => 'wrong attachement' ) );
139
  exit;
140
  }
141
- $src_file = ABSPATH . str_replace(get_bloginfo('url'), '', $src_file_url[0]);
142
 
143
  $dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
144
  if (!$dst_file_url) {
145
  echo json_encode (array('status' => 'error', 'message' => 'wrong size' ) );
146
  exit;
147
  }
148
- $dst_file = ABSPATH . str_replace(get_bloginfo('url'), '', $dst_file_url[0]);
149
-
150
  if (isset($_wp_additional_image_sizes[$_POST['editedSize']])) {
151
  $dst_w = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['width']), $_POST['select']['w'] * $_POST['previewScale']);;
152
  $dst_h = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['height']), $_POST['select']['h'] * $_POST['previewScale']);
132
  */
133
  public function cropImage() {
134
  global $_wp_additional_image_sizes;
135
+
136
+ $uploadsDir = wp_upload_dir();
137
 
138
  $src_file_url = wp_get_attachment_image_src($_POST['attachmentId'], 'full');
139
  if (!$src_file_url) {
140
  echo json_encode (array('status' => 'error', 'message' => 'wrong attachement' ) );
141
  exit;
142
  }
143
+ $src_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $src_file_url[0]);
144
 
145
  $dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
146
  if (!$dst_file_url) {
147
  echo json_encode (array('status' => 'error', 'message' => 'wrong size' ) );
148
  exit;
149
  }
150
+ $dst_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $dst_file_url[0]);
151
+
152
  if (isset($_wp_additional_image_sizes[$_POST['editedSize']])) {
153
  $dst_w = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['width']), $_POST['select']['w'] * $_POST['previewScale']);;
154
  $dst_h = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['height']), $_POST['select']['h'] * $_POST['previewScale']);
lib/ManualImageCropEditorWindow.php CHANGED
@@ -53,8 +53,16 @@ class ManualImageCropEditorWindow {
53
  $height = get_option($editedSize.'_size_h');
54
  $cropMethod = get_option($editedSize.'_crop');
55
  }
 
 
56
 
57
- $sizes = getimagesize(wp_get_attachment_url($_GET['postId'], 'full'));
 
 
 
 
 
 
58
 
59
  $previewWidth = min($sizes[0], 500);
60
  $previewHeight = min($sizes[1], 350);
53
  $height = get_option($editedSize.'_size_h');
54
  $cropMethod = get_option($editedSize.'_crop');
55
  }
56
+
57
+ $uploadsDir = wp_upload_dir();
58
 
59
+ $src_file_url = wp_get_attachment_image_src($_GET['postId'], 'full');
60
+ if (!$src_file_url) {
61
+ echo json_encode (array('status' => 'error', 'message' => 'wrong attachement' ) );
62
+ exit;
63
+ }
64
+ $src_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $src_file_url[0]);
65
+ $sizes = getimagesize($src_file);
66
 
67
  $previewWidth = min($sizes[0], 500);
68
  $previewHeight = min($sizes[1], 350);
manual-image-crop.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Manual Image Crop
4
  Plugin URI: http://www.rocketmill.co.uk/wordpress-plugin-manual-image-crop
5
  Description: Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image). Simply click on the "Crop" link next to any image in your media library and select the area of the image you want to crop.
6
- Version: 1.01
7
  Author: Tomasz Sita
8
  Author URI: http://www.rocketmill.co.uk/author/tomasz
9
  License: GPL2
10
  */
11
 
12
- define('mic_VERSION', '1.01');
13
 
14
  include_once(dirname(__FILE__) . '/lib/ManualImageCrop.php');
15
  include_once(dirname(__FILE__) . '/lib/ManualImageCropEditorWindow.php');
3
  Plugin Name: Manual Image Crop
4
  Plugin URI: http://www.rocketmill.co.uk/wordpress-plugin-manual-image-crop
5
  Description: Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image). Simply click on the "Crop" link next to any image in your media library and select the area of the image you want to crop.
6
+ Version: 1.02
7
  Author: Tomasz Sita
8
  Author URI: http://www.rocketmill.co.uk/author/tomasz
9
  License: GPL2
10
  */
11
 
12
+ define('mic_VERSION', '1.02');
13
 
14
  include_once(dirname(__FILE__) . '/lib/ManualImageCrop.php');
15
  include_once(dirname(__FILE__) . '/lib/ManualImageCropEditorWindow.php');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 3.0.1
5
  Tested up to: 3.6
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
- Stable tag: 1.01
9
 
10
  Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
11
 
@@ -35,9 +35,13 @@ Automatically:
35
 
36
  == Changelog ==
37
 
38
- = 1.0 =
39
- Initial version
 
40
 
41
  = 1.01 =
42
  -Fixed Chrome stretched image issue
43
- -Improved compatibility with other plugins using 'thickbox'
 
 
 
5
  Tested up to: 3.6
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
+ Stable tag: 1.02
9
 
10
  Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
11
 
35
 
36
  == Changelog ==
37
 
38
+ = 1.02 =
39
+ -Fixed HTTP Authentication no preview issue
40
+ -Fixed path issues on multisite/subfolder WP installations
41
 
42
  = 1.01 =
43
  -Fixed Chrome stretched image issue
44
+ -Improved compatibility with other plugins using 'thickbox'
45
+
46
+ = 1.0 =
47
+ Initial version