Version Description
- French, German, Italian, Polish, Spanish translations added
- Settings page added (quality, visibility, custom labels)
- Compatibility with Retina/HiDPI (@2x) plugin added
- Fixed issue with closing editor window from within media uploader screen
Download this release
Release Info
Developer | tomasz.sita |
Plugin | Manual Image Crop |
Version | 1.06 |
Comparing to | |
See all releases |
Code changes from version 1.05 to 1.06
- assets/css/mic-admin.css +98 -58
- assets/js/microp.js +67 -63
- languages/microp-de_DE.mo +0 -0
- languages/microp-de_DE.po +163 -0
- languages/microp-es_ES.mo +0 -0
- languages/microp-es_ES.po +165 -0
- languages/microp-fr_FR.mo +0 -0
- languages/microp-fr_FR.po +167 -0
- languages/microp-it_IT.mo +0 -0
- languages/microp-it_IT.po +163 -0
- languages/microp-pl_PL.mo +0 -0
- languages/microp-pl_PL.po +163 -0
- lib/ManualImageCrop.php +274 -224
- lib/ManualImageCropEditorWindow.php +243 -186
- lib/ManualImageCropSettingsPage.php +172 -0
- manual-image-crop.php +61 -57
- readme.txt +73 -57
assets/css/mic-admin.css
CHANGED
@@ -1,59 +1,99 @@
|
|
1 |
-
#TB_window {
|
2 |
-
z-index: 260001 !important;
|
3 |
-
}
|
4 |
-
#TB_overlay {
|
5 |
-
z-index: 260000 !important;
|
6 |
-
}
|
7 |
-
|
8 |
-
.mic-editor-wrapper {
|
9 |
-
width: 940px;
|
10 |
-
}
|
11 |
-
|
12 |
-
.mic-left-col {
|
13 |
-
float: left;
|
14 |
-
width: 500px;
|
15 |
-
margin-right: 20px;
|
16 |
-
}
|
17 |
-
.mic-right-col {
|
18 |
-
float: left;
|
19 |
-
width: 400px;
|
20 |
-
}
|
21 |
-
|
22 |
-
.mic-48-col {
|
23 |
-
width: 48%;
|
24 |
-
float: right;
|
25 |
-
margin: 20px 0px;
|
26 |
-
}
|
27 |
-
|
28 |
-
.mic-52-col {
|
29 |
-
width: 48%;
|
30 |
-
float: left;
|
31 |
-
margin: 20px 0px;
|
32 |
-
}
|
33 |
-
|
34 |
-
.mic-centred {
|
35 |
-
text-align: center;
|
36 |
-
}
|
37 |
-
|
38 |
-
#micCropImage {
|
39 |
-
margin: auto !important;
|
40 |
-
display: block !important;
|
41 |
-
border-radius: 0;
|
42 |
-
}
|
43 |
-
|
44 |
-
#micLoading {
|
45 |
-
display: none;
|
46 |
-
}
|
47 |
-
|
48 |
-
.mic-editor-wrapper h2 .nav-tab {
|
49 |
-
font-size: 16px;
|
50 |
-
padding: 4px;
|
51 |
-
}
|
52 |
-
|
53 |
-
#micSuccessMessage, #micFailureMessage {
|
54 |
-
display: none;
|
55 |
-
}
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
1 |
+
#TB_window {
|
2 |
+
z-index: 260001 !important;
|
3 |
+
}
|
4 |
+
#TB_overlay {
|
5 |
+
z-index: 260000 !important;
|
6 |
+
}
|
7 |
+
|
8 |
+
.mic-editor-wrapper {
|
9 |
+
width: 940px;
|
10 |
+
}
|
11 |
+
|
12 |
+
.mic-left-col {
|
13 |
+
float: left;
|
14 |
+
width: 500px;
|
15 |
+
margin-right: 20px;
|
16 |
+
}
|
17 |
+
.mic-right-col {
|
18 |
+
float: left;
|
19 |
+
width: 400px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.mic-48-col {
|
23 |
+
width: 48%;
|
24 |
+
float: right;
|
25 |
+
margin: 20px 0px;
|
26 |
+
}
|
27 |
+
|
28 |
+
.mic-52-col {
|
29 |
+
width: 48%;
|
30 |
+
float: left;
|
31 |
+
margin: 20px 0px;
|
32 |
+
}
|
33 |
+
|
34 |
+
.mic-centred {
|
35 |
+
text-align: center;
|
36 |
+
}
|
37 |
+
|
38 |
+
#micCropImage {
|
39 |
+
margin: auto !important;
|
40 |
+
display: block !important;
|
41 |
+
border-radius: 0;
|
42 |
+
}
|
43 |
+
|
44 |
+
#micLoading {
|
45 |
+
display: none;
|
46 |
+
}
|
47 |
+
|
48 |
+
.mic-editor-wrapper h2 .nav-tab {
|
49 |
+
font-size: 16px;
|
50 |
+
padding: 4px;
|
51 |
+
}
|
52 |
+
|
53 |
+
#micSuccessMessage, #micFailureMessage {
|
54 |
+
display: none;
|
55 |
+
}
|
56 |
+
|
57 |
+
#mic-2x-status {
|
58 |
+
font-weight: bold;
|
59 |
+
display: none;
|
60 |
+
}
|
61 |
+
|
62 |
+
#mic-2x-status:before {
|
63 |
+
display: inline-block;
|
64 |
+
-webkit-font-smoothing: antialiased;
|
65 |
+
font: normal 20px/1 'dashicons';
|
66 |
+
vertical-align: top;
|
67 |
+
content: "\f158";
|
68 |
+
color: #dd3d36;
|
69 |
+
line-height: 0.8em;
|
70 |
+
}
|
71 |
+
|
72 |
+
#mic-2x-status.mic-ok:before {
|
73 |
+
content: "\f147";
|
74 |
+
color: #7ad03a;
|
75 |
+
}
|
76 |
+
|
77 |
+
.crop-image {
|
78 |
+
margin-right: 10px;
|
79 |
+
}
|
80 |
+
|
81 |
+
.mic-settings-page .form-table th[scope="row"] {
|
82 |
+
display: none;
|
83 |
+
}
|
84 |
+
|
85 |
+
.mic-editor-wrapper h4 {
|
86 |
+
float: left;
|
87 |
+
width: 120px;
|
88 |
+
margin-top: 23px;
|
89 |
+
line-height: 11px;
|
90 |
+
}
|
91 |
+
|
92 |
+
.mic-editor-wrapper .nav-tab-wrapper {
|
93 |
+
float: left;
|
94 |
+
width: 820px;
|
95 |
+
}
|
96 |
+
|
97 |
+
.mic-option {
|
98 |
+
margin-top: 10px;
|
99 |
}
|
assets/js/microp.js
CHANGED
@@ -1,64 +1,68 @@
|
|
1 |
-
var jcrop_api, mic_attachment_id, mic_edited_size, mic_preview_scale;
|
2 |
-
|
3 |
-
jQuery(document).ready(function($) {
|
4 |
-
//image sizes tabs
|
5 |
-
$(document).on('click', '.rm-crop-size-tab', function(e) {
|
6 |
-
e.preventDefault();
|
7 |
-
$(this).addClass('nav-tab-active');
|
8 |
-
$.get($(this).attr('href'), function(data) {
|
9 |
-
$('#TB_ajaxContent').html(data);
|
10 |
-
});
|
11 |
-
});
|
12 |
-
|
13 |
-
$( document ).on('click', '#micCropImage', function() {
|
14 |
-
$('#micCropImage').hide();
|
15 |
-
$('#micLoading').show();
|
16 |
-
$.post(ajaxurl + '?action=mic_crop_image', { select: jcrop_api.tellSelect(), scaled: jcrop_api.tellScaled(), attachmentId: mic_attachment_id, editedSize: mic_edited_size, previewScale: mic_preview_scale } , function(response) {
|
17 |
-
if (response.status == 'ok') {
|
18 |
-
var newImage = new Image();
|
19 |
-
newImage.src = response.file;
|
20 |
-
var count = 0;
|
21 |
-
function updateImage() {
|
22 |
-
if(newImage.complete) {
|
23 |
-
$('#micPreviousImage').attr('src', newImage.src);
|
24 |
-
$('#micCropImage').show();
|
25 |
-
$('#micSuccessMessage').show().delay(5000).fadeOut();
|
26 |
-
$('#micLoading').hide();
|
27 |
-
}else {
|
28 |
-
setTimeout(updateImage, 200);
|
29 |
-
}
|
30 |
-
}
|
31 |
-
updateImage();
|
32 |
-
}else {
|
33 |
-
$('#micFailureMessage').show().delay(5000).fadeOut();
|
34 |
-
$('#micCropImage').show();
|
35 |
-
$('#micLoading').hide();
|
36 |
-
}
|
37 |
-
}, 'json');
|
38 |
-
});
|
39 |
-
|
40 |
-
$('.mic-link').click( function() {
|
41 |
-
tb_position();
|
42 |
-
});
|
43 |
-
|
44 |
-
function
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
64 |
});
|
1 |
+
var jcrop_api, mic_attachment_id, mic_edited_size, mic_preview_scale;
|
2 |
+
|
3 |
+
jQuery(document).ready(function($) {
|
4 |
+
//image sizes tabs
|
5 |
+
$(document).on('click', '.rm-crop-size-tab', function(e) {
|
6 |
+
e.preventDefault();
|
7 |
+
$(this).addClass('nav-tab-active');
|
8 |
+
$.get($(this).attr('href'), function(data) {
|
9 |
+
$('#TB_ajaxContent').html(data);
|
10 |
+
});
|
11 |
+
});
|
12 |
+
|
13 |
+
$( document ).on('click', '#micCropImage', function() {
|
14 |
+
$('#micCropImage').hide();
|
15 |
+
$('#micLoading').show();
|
16 |
+
$.post(ajaxurl + '?action=mic_crop_image', { select: jcrop_api.tellSelect(), scaled: jcrop_api.tellScaled(), attachmentId: mic_attachment_id, editedSize: mic_edited_size, previewScale: mic_preview_scale, make2x: $('#mic-make-2x').prop('checked'), mic_quality: $('#micQuality').val() } , function(response) {
|
17 |
+
if (response.status == 'ok') {
|
18 |
+
var newImage = new Image();
|
19 |
+
newImage.src = response.file;
|
20 |
+
var count = 0;
|
21 |
+
function updateImage() {
|
22 |
+
if(newImage.complete) {
|
23 |
+
$('#micPreviousImage').attr('src', newImage.src);
|
24 |
+
$('#micCropImage').show();
|
25 |
+
$('#micSuccessMessage').show().delay(5000).fadeOut();
|
26 |
+
$('#micLoading').hide();
|
27 |
+
}else {
|
28 |
+
setTimeout(updateImage, 200);
|
29 |
+
}
|
30 |
+
}
|
31 |
+
updateImage();
|
32 |
+
}else {
|
33 |
+
$('#micFailureMessage').show().delay(5000).fadeOut();
|
34 |
+
$('#micCropImage').show();
|
35 |
+
$('#micLoading').hide();
|
36 |
+
}
|
37 |
+
}, 'json');
|
38 |
+
});
|
39 |
+
|
40 |
+
$('.mic-link').click( function() {
|
41 |
+
tb_position();
|
42 |
+
});
|
43 |
+
|
44 |
+
$(document).on('click', '#TB_closeWindowButton, .TB_overlayBG', function(e) {
|
45 |
+
$('#TB_overlay,#TB_window').remove();
|
46 |
+
});
|
47 |
+
|
48 |
+
function adjustMicWindowSize() {
|
49 |
+
if( ! $('#TB_ajaxContent .mic-editor-wrapper').length) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
var tbWindow = $('#TB_window'), width = $(window).width(), H = 560, W = ( 980 < width ) ? 980 : width, adminbar_height = 0;
|
53 |
+
|
54 |
+
if ( $('body.admin-bar').length )
|
55 |
+
adminbar_height = 28;
|
56 |
+
|
57 |
+
if ( tbWindow.size() ) {
|
58 |
+
tbWindow.width( W ).height( H - 45 - adminbar_height );
|
59 |
+
$('#TB_iframeContent, #TB_ajaxContent').width( W).height( H - 75 - adminbar_height );
|
60 |
+
tbWindow.css({'margin-left': '-' + parseInt((( W) / 2),10) + 'px'});
|
61 |
+
if ( typeof document.body.style.maxWidth != 'undefined' )
|
62 |
+
tbWindow.css({'top': 20 + adminbar_height + 'px','margin-top':'0'});
|
63 |
+
};
|
64 |
+
}
|
65 |
+
|
66 |
+
setInterval(adjustMicWindowSize, 200);
|
67 |
+
|
68 |
});
|
languages/microp-de_DE.mo
ADDED
Binary file
|
languages/microp-de_DE.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: mic\n"
|
4 |
+
"POT-Creation-Date: 2014-05-13 22:40-0000\n"
|
5 |
+
"PO-Revision-Date: 2014-05-13 22:41-0000\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SearchPath-0: C:\\wamp\\www\\wordpress\\wp-content\\plugins\\manual-"
|
15 |
+
"image-crop\n"
|
16 |
+
|
17 |
+
#: manual-image-crop/lib/ManualImageCrop.php:58
|
18 |
+
msgid "Crop"
|
19 |
+
msgstr "Ausschnitt"
|
20 |
+
|
21 |
+
#: manual-image-crop/lib/ManualImageCrop.php:67
|
22 |
+
msgid "Crop featured image"
|
23 |
+
msgstr "Beitragsbild Ausschneiden"
|
24 |
+
|
25 |
+
#: manual-image-crop/lib/ManualImageCrop.php:94
|
26 |
+
#: manual-image-crop/lib/ManualImageCrop.php:121
|
27 |
+
msgid "Crop Image"
|
28 |
+
msgstr "Bild Ausschneiden"
|
29 |
+
|
30 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:31
|
31 |
+
msgid "Pick the image size:"
|
32 |
+
msgstr "Wählen Sie die Bildgröße"
|
33 |
+
|
34 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:41
|
35 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:115
|
36 |
+
msgid "Thumbnail"
|
37 |
+
msgstr "Miniaturbild"
|
38 |
+
|
39 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:42
|
40 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:116
|
41 |
+
msgid "Medium"
|
42 |
+
msgstr "Mittlere Bildgröße"
|
43 |
+
|
44 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:43
|
45 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:117
|
46 |
+
msgid "Large"
|
47 |
+
msgstr "Maximale Bildgröße"
|
48 |
+
|
49 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:44
|
50 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:118
|
51 |
+
msgid "Full Size"
|
52 |
+
msgstr "Ursprünglichen Größe"
|
53 |
+
|
54 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:142
|
55 |
+
msgid "Original picture dimensions:"
|
56 |
+
msgstr "Original-Bildabmessungen"
|
57 |
+
|
58 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
59 |
+
msgid "Target picture dimensions:"
|
60 |
+
msgstr "Zielbildabmessungen"
|
61 |
+
|
62 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
63 |
+
msgid "Soft proportional crop mode"
|
64 |
+
msgstr "Soft proportional Ausschnitt Modus"
|
65 |
+
|
66 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
67 |
+
msgid "Hard crop mode"
|
68 |
+
msgstr "Fest Ausschnitt Modus"
|
69 |
+
|
70 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:147
|
71 |
+
msgid "New image:"
|
72 |
+
msgstr "Neue Bild"
|
73 |
+
|
74 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:154
|
75 |
+
msgid "Previous image:"
|
76 |
+
msgstr "Vorheriges Bild"
|
77 |
+
|
78 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:162
|
79 |
+
msgid "Crop it!"
|
80 |
+
msgstr "Ausschneiden!"
|
81 |
+
|
82 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:169
|
83 |
+
msgid "Target JPEG Quality"
|
84 |
+
msgstr "Ziel JPEG-Qualität"
|
85 |
+
|
86 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:170
|
87 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:154
|
88 |
+
msgid "100 (best quality, biggest file)"
|
89 |
+
msgstr "100 (beste Qualität, größte Datei)"
|
90 |
+
|
91 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:171
|
92 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:155
|
93 |
+
msgid "80 (very high quality)"
|
94 |
+
msgstr "80 (sehr hoher Qualität)"
|
95 |
+
|
96 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:172
|
97 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:156
|
98 |
+
msgid "70 (high quality)"
|
99 |
+
msgstr "70 (hoher Qualität)"
|
100 |
+
|
101 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:173
|
102 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:157
|
103 |
+
msgid "60 (good)"
|
104 |
+
msgstr "60 (gute Qualität)"
|
105 |
+
|
106 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:174
|
107 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:158
|
108 |
+
msgid "50 (average)"
|
109 |
+
msgstr "50 (mittelmäßige Qualität)"
|
110 |
+
|
111 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:175
|
112 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:159
|
113 |
+
msgid "30 (low)"
|
114 |
+
msgstr "30 (niedrige Qualität)"
|
115 |
+
|
116 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:176
|
117 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:160
|
118 |
+
msgid "10 (very low, smallest file)"
|
119 |
+
msgstr "10 (sehr geringe Qualität)"
|
120 |
+
|
121 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:183
|
122 |
+
msgid "Generate Retina/HiDPI (@2x):"
|
123 |
+
msgstr "Retina/HiDPI (@2x) erzeugen"
|
124 |
+
|
125 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:188
|
126 |
+
msgid "The image has been cropped successfully"
|
127 |
+
msgstr "Das Bild wurde erfolgreich abgeschnitten worden"
|
128 |
+
|
129 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:189
|
130 |
+
msgid "An Error has occured. Please try again or contact plugin's author."
|
131 |
+
msgstr "Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut oder Kontaktdaten Plugin Autor"
|
132 |
+
|
133 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:232
|
134 |
+
msgid "Compatible"
|
135 |
+
msgstr "Kompatibel"
|
136 |
+
|
137 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:234
|
138 |
+
msgid "Source too small"
|
139 |
+
msgstr "Ursprung bild zu klein"
|
140 |
+
|
141 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:125
|
142 |
+
msgid "Size"
|
143 |
+
msgstr "Größe"
|
144 |
+
|
145 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:126
|
146 |
+
msgid "Visible"
|
147 |
+
msgstr "Sichtbar"
|
148 |
+
|
149 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:127
|
150 |
+
msgid "Default JPEG Quality"
|
151 |
+
msgstr "Standard JPEG-Qualität"
|
152 |
+
|
153 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:128
|
154 |
+
msgid "Custom Label"
|
155 |
+
msgstr "angepasst Beschriftung"
|
156 |
+
|
157 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:150
|
158 |
+
msgid "Yes"
|
159 |
+
msgstr "Ja"
|
160 |
+
|
161 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:151
|
162 |
+
msgid "No"
|
163 |
+
msgstr "Nein"
|
languages/microp-es_ES.mo
ADDED
Binary file
|
languages/microp-es_ES.po
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: mic\n"
|
4 |
+
"POT-Creation-Date: 2014-05-13 22:40-0000\n"
|
5 |
+
"PO-Revision-Date: 2014-05-19 12:27+0100\n"
|
6 |
+
"Last-Translator: jelena kovacevic <jecajeca260@gmail.com>\n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.5\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SearchPath-0: C:\\wamp\\www\\wordpress\\wp-content\\plugins\\manual-"
|
15 |
+
"image-crop\n"
|
16 |
+
|
17 |
+
#: manual-image-crop/lib/ManualImageCrop.php:58
|
18 |
+
msgid "Crop"
|
19 |
+
msgstr "Recortar"
|
20 |
+
|
21 |
+
#: manual-image-crop/lib/ManualImageCrop.php:67
|
22 |
+
msgid "Crop featured image"
|
23 |
+
msgstr "Recortar Imagen destacada"
|
24 |
+
|
25 |
+
#: manual-image-crop/lib/ManualImageCrop.php:94
|
26 |
+
#: manual-image-crop/lib/ManualImageCrop.php:121
|
27 |
+
msgid "Crop Image"
|
28 |
+
msgstr "Recortar Imagen"
|
29 |
+
|
30 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:31
|
31 |
+
msgid "Pick the image size:"
|
32 |
+
msgstr "Elija el tamaño correcto:"
|
33 |
+
|
34 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:41
|
35 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:115
|
36 |
+
msgid "Thumbnail"
|
37 |
+
msgstr "Miniatura "
|
38 |
+
|
39 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:42
|
40 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:116
|
41 |
+
msgid "Medium"
|
42 |
+
msgstr "Mediano"
|
43 |
+
|
44 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:43
|
45 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:117
|
46 |
+
msgid "Large"
|
47 |
+
msgstr "Grande"
|
48 |
+
|
49 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:44
|
50 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:118
|
51 |
+
msgid "Full Size"
|
52 |
+
msgstr "Tamaño Completo "
|
53 |
+
|
54 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:142
|
55 |
+
msgid "Original picture dimensions:"
|
56 |
+
msgstr "Dimensiones originales de la imagen"
|
57 |
+
|
58 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
59 |
+
msgid "Target picture dimensions:"
|
60 |
+
msgstr "Dimensiones de imagen objetivo"
|
61 |
+
|
62 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
63 |
+
msgid "Soft proportional crop mode"
|
64 |
+
msgstr "Modo de recorte suave proporcional"
|
65 |
+
|
66 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
67 |
+
msgid "Hard crop mode"
|
68 |
+
msgstr "Modo de recorte duro "
|
69 |
+
|
70 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:147
|
71 |
+
msgid "New image:"
|
72 |
+
msgstr "Nueva Imagen:"
|
73 |
+
|
74 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:154
|
75 |
+
msgid "Previous image:"
|
76 |
+
msgstr "Imagen Anterior:"
|
77 |
+
|
78 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:162
|
79 |
+
msgid "Crop it!"
|
80 |
+
msgstr "¡Recórtala!"
|
81 |
+
|
82 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:169
|
83 |
+
msgid "Target JPEG Quality"
|
84 |
+
msgstr "Calidad de JPEG Objetivo"
|
85 |
+
|
86 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:170
|
87 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:154
|
88 |
+
msgid "100 (best quality, biggest file)"
|
89 |
+
msgstr "100 (mejor calidad, archivo más grande)"
|
90 |
+
|
91 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:171
|
92 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:155
|
93 |
+
msgid "80 (very high quality)"
|
94 |
+
msgstr "80 (muy alta calidad)"
|
95 |
+
|
96 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:172
|
97 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:156
|
98 |
+
msgid "70 (high quality)"
|
99 |
+
msgstr "70 (alta calidad)"
|
100 |
+
|
101 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:173
|
102 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:157
|
103 |
+
msgid "60 (good)"
|
104 |
+
msgstr "60 (buena)"
|
105 |
+
|
106 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:174
|
107 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:158
|
108 |
+
msgid "50 (average)"
|
109 |
+
msgstr "50 (promedio)"
|
110 |
+
|
111 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:175
|
112 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:159
|
113 |
+
msgid "30 (low)"
|
114 |
+
msgstr "30 (baja)"
|
115 |
+
|
116 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:176
|
117 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:160
|
118 |
+
msgid "10 (very low, smallest file)"
|
119 |
+
msgstr "10 (muy baja, archivo más pequeño)"
|
120 |
+
|
121 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:183
|
122 |
+
msgid "Generate Retina/HiDPI (@2x):"
|
123 |
+
msgstr "Generar Retina/HiDPI (@2x):"
|
124 |
+
|
125 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:188
|
126 |
+
msgid "The image has been cropped successfully"
|
127 |
+
msgstr "La imagen ha sido recortada con éxito"
|
128 |
+
|
129 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:189
|
130 |
+
msgid "An Error has occured. Please try again or contact plugin's author."
|
131 |
+
msgstr ""
|
132 |
+
"Ha ocurrido un Error. Por favor inténtelo de nuevp o contacte al autor del "
|
133 |
+
"plugin."
|
134 |
+
|
135 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:232
|
136 |
+
msgid "Compatible"
|
137 |
+
msgstr "Compatible"
|
138 |
+
|
139 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:234
|
140 |
+
msgid "Source too small"
|
141 |
+
msgstr "Fuente demasiado pequeña"
|
142 |
+
|
143 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:125
|
144 |
+
msgid "Size"
|
145 |
+
msgstr "Tamaño"
|
146 |
+
|
147 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:126
|
148 |
+
msgid "Visible"
|
149 |
+
msgstr "Visible"
|
150 |
+
|
151 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:127
|
152 |
+
msgid "Default JPEG Quality"
|
153 |
+
msgstr "Calidad JPEG Predeterminada"
|
154 |
+
|
155 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:128
|
156 |
+
msgid "Custom Label"
|
157 |
+
msgstr "Etiqueta Personalizada"
|
158 |
+
|
159 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:150
|
160 |
+
msgid "Yes"
|
161 |
+
msgstr "Sí"
|
162 |
+
|
163 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:151
|
164 |
+
msgid "No"
|
165 |
+
msgstr "No"
|
languages/microp-fr_FR.mo
ADDED
Binary file
|
languages/microp-fr_FR.po
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: mic\n"
|
4 |
+
"POT-Creation-Date: 2014-05-13 22:40-0000\n"
|
5 |
+
"PO-Revision-Date: 2014-06-18 15:40+0100\n"
|
6 |
+
"Last-Translator: Gabriel Féron <gabriel.feron@lepape.com>\n"
|
7 |
+
"Language-Team: <feron.gabriel@gmail.com>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.4\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"Language: fr_FR\n"
|
15 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
16 |
+
"X-Poedit-SearchPath-0: C:\\wamp\\www\\wordpress\\wp-content\\plugins\\manual-"
|
17 |
+
"image-crop\n"
|
18 |
+
|
19 |
+
#: manual-image-crop/lib/ManualImageCrop.php:58
|
20 |
+
msgid "Crop"
|
21 |
+
msgstr "Recadrage"
|
22 |
+
|
23 |
+
#: manual-image-crop/lib/ManualImageCrop.php:67
|
24 |
+
msgid "Crop featured image"
|
25 |
+
msgstr "Recadrer l'image à la Une"
|
26 |
+
|
27 |
+
#: manual-image-crop/lib/ManualImageCrop.php:94
|
28 |
+
#: manual-image-crop/lib/ManualImageCrop.php:121
|
29 |
+
msgid "Crop Image"
|
30 |
+
msgstr "Recadrer l'image"
|
31 |
+
|
32 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:31
|
33 |
+
msgid "Pick the image size:"
|
34 |
+
msgstr "Choisissez une taille :"
|
35 |
+
|
36 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:41
|
37 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:115
|
38 |
+
msgid "Thumbnail"
|
39 |
+
msgstr "Miniature"
|
40 |
+
|
41 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:42
|
42 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:116
|
43 |
+
msgid "Medium"
|
44 |
+
msgstr "Moyen"
|
45 |
+
|
46 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:43
|
47 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:117
|
48 |
+
msgid "Large"
|
49 |
+
msgstr "Large"
|
50 |
+
|
51 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:44
|
52 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:118
|
53 |
+
msgid "Full Size"
|
54 |
+
msgstr "Taille d'origine"
|
55 |
+
|
56 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:142
|
57 |
+
msgid "Original picture dimensions:"
|
58 |
+
msgstr "Dimension originales :"
|
59 |
+
|
60 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
61 |
+
msgid "Target picture dimensions:"
|
62 |
+
msgstr "Dimensions cibles :"
|
63 |
+
|
64 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
65 |
+
msgid "Soft proportional crop mode"
|
66 |
+
msgstr "Recadrage proportionnel"
|
67 |
+
|
68 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
69 |
+
msgid "Hard crop mode"
|
70 |
+
msgstr "Recadrage non proportionnel"
|
71 |
+
|
72 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:147
|
73 |
+
msgid "New image:"
|
74 |
+
msgstr "Nouvelle image :"
|
75 |
+
|
76 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:154
|
77 |
+
msgid "Previous image:"
|
78 |
+
msgstr "Image précédente :"
|
79 |
+
|
80 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:162
|
81 |
+
msgid "Crop it!"
|
82 |
+
msgstr "Recadrer !"
|
83 |
+
|
84 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:169
|
85 |
+
msgid "Target JPEG Quality"
|
86 |
+
msgstr "Qualité JPEG"
|
87 |
+
|
88 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:170
|
89 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:154
|
90 |
+
msgid "100 (best quality, biggest file)"
|
91 |
+
msgstr "100 (qualité maximale, compression faible)"
|
92 |
+
|
93 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:171
|
94 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:155
|
95 |
+
msgid "80 (very high quality)"
|
96 |
+
msgstr "80 (très haute qualité)"
|
97 |
+
|
98 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:172
|
99 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:156
|
100 |
+
msgid "70 (high quality)"
|
101 |
+
msgstr "70 (haute qualité)"
|
102 |
+
|
103 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:173
|
104 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:157
|
105 |
+
msgid "60 (good)"
|
106 |
+
msgstr "60 (bon)"
|
107 |
+
|
108 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:174
|
109 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:158
|
110 |
+
msgid "50 (average)"
|
111 |
+
msgstr "50 (moyen)"
|
112 |
+
|
113 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:175
|
114 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:159
|
115 |
+
msgid "30 (low)"
|
116 |
+
msgstr "30 (faible)"
|
117 |
+
|
118 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:176
|
119 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:160
|
120 |
+
msgid "10 (very low, smallest file)"
|
121 |
+
msgstr "10 (basse qualité, compression forte)"
|
122 |
+
|
123 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:183
|
124 |
+
msgid "Generate Retina/HiDPI (@2x):"
|
125 |
+
msgstr "Générer l'image Retina/HiDPI (@2x)"
|
126 |
+
|
127 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:188
|
128 |
+
msgid "The image has been cropped successfully"
|
129 |
+
msgstr "L'image a été correctement recadrée"
|
130 |
+
|
131 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:189
|
132 |
+
msgid "An Error has occured. Please try again or contact plugin's author."
|
133 |
+
msgstr ""
|
134 |
+
"Une erreur est survenue. Merci de réessayer plus tard ou de contacter "
|
135 |
+
"l'auteur du plugin."
|
136 |
+
|
137 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:232
|
138 |
+
msgid "Compatible"
|
139 |
+
msgstr "Compatible"
|
140 |
+
|
141 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:234
|
142 |
+
msgid "Source too small"
|
143 |
+
msgstr "Image source trop petite"
|
144 |
+
|
145 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:125
|
146 |
+
msgid "Size"
|
147 |
+
msgstr "Taille"
|
148 |
+
|
149 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:126
|
150 |
+
msgid "Visible"
|
151 |
+
msgstr "Visible"
|
152 |
+
|
153 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:127
|
154 |
+
msgid "Default JPEG Quality"
|
155 |
+
msgstr "Qualité JPEG par défaut"
|
156 |
+
|
157 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:128
|
158 |
+
msgid "Custom Label"
|
159 |
+
msgstr "Légende personnalisée"
|
160 |
+
|
161 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:150
|
162 |
+
msgid "Yes"
|
163 |
+
msgstr "Oui"
|
164 |
+
|
165 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:151
|
166 |
+
msgid "No"
|
167 |
+
msgstr "Non"
|
languages/microp-it_IT.mo
ADDED
Binary file
|
languages/microp-it_IT.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: mic\n"
|
4 |
+
"POT-Creation-Date: 2014-05-13 22:40-0000\n"
|
5 |
+
"PO-Revision-Date: 2014-05-13 22:41-0000\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SearchPath-0: C:\\wamp\\www\\wordpress\\wp-content\\plugins\\manual-"
|
15 |
+
"image-crop\n"
|
16 |
+
|
17 |
+
#: manual-image-crop/lib/ManualImageCrop.php:58
|
18 |
+
msgid "Crop"
|
19 |
+
msgstr "Ritaglia"
|
20 |
+
|
21 |
+
#: manual-image-crop/lib/ManualImageCrop.php:67
|
22 |
+
msgid "Crop featured image"
|
23 |
+
msgstr "Ritaglia immagine in evidenza"
|
24 |
+
|
25 |
+
#: manual-image-crop/lib/ManualImageCrop.php:94
|
26 |
+
#: manual-image-crop/lib/ManualImageCrop.php:121
|
27 |
+
msgid "Crop Image"
|
28 |
+
msgstr "Ritaglia immagine"
|
29 |
+
|
30 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:31
|
31 |
+
msgid "Pick the image size:"
|
32 |
+
msgstr "Scegli la dimensione dell'immagine:"
|
33 |
+
|
34 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:41
|
35 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:115
|
36 |
+
msgid "Thumbnail"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:42
|
40 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:116
|
41 |
+
msgid "Medium"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:43
|
45 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:117
|
46 |
+
msgid "Large"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:44
|
50 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:118
|
51 |
+
msgid "Full Size"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:142
|
55 |
+
msgid "Original picture dimensions:"
|
56 |
+
msgstr "Dimensione originale:"
|
57 |
+
|
58 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
59 |
+
msgid "Target picture dimensions:"
|
60 |
+
msgstr "Dimensione obiettivo:"
|
61 |
+
|
62 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
63 |
+
msgid "Soft proportional crop mode"
|
64 |
+
msgstr "Taglio proporzionale"
|
65 |
+
|
66 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
67 |
+
msgid "Hard crop mode"
|
68 |
+
msgstr "Taglio non proporzionale"
|
69 |
+
|
70 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:147
|
71 |
+
msgid "New image:"
|
72 |
+
msgstr "Nuova immagine:"
|
73 |
+
|
74 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:154
|
75 |
+
msgid "Previous image:"
|
76 |
+
msgstr "Immagine precedente:"
|
77 |
+
|
78 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:162
|
79 |
+
msgid "Crop it!"
|
80 |
+
msgstr "Ritagliala!"
|
81 |
+
|
82 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:169
|
83 |
+
msgid "Target JPEG Quality"
|
84 |
+
msgstr "Obiettivo Qualita JPEG"
|
85 |
+
|
86 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:170
|
87 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:154
|
88 |
+
msgid "100 (best quality, biggest file)"
|
89 |
+
msgstr "100 (migliore qualita, piu grande di file)"
|
90 |
+
|
91 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:171
|
92 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:155
|
93 |
+
msgid "80 (very high quality)"
|
94 |
+
msgstr "80 (alta qualita)"
|
95 |
+
|
96 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:172
|
97 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:156
|
98 |
+
msgid "70 (high quality)"
|
99 |
+
msgstr "70 (alta qualita)"
|
100 |
+
|
101 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:173
|
102 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:157
|
103 |
+
msgid "60 (good)"
|
104 |
+
msgstr "60 (buono)"
|
105 |
+
|
106 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:174
|
107 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:158
|
108 |
+
msgid "50 (average)"
|
109 |
+
msgstr "50 (media)"
|
110 |
+
|
111 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:175
|
112 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:159
|
113 |
+
msgid "30 (low)"
|
114 |
+
msgstr "30 (basso)"
|
115 |
+
|
116 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:176
|
117 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:160
|
118 |
+
msgid "10 (very low, smallest file)"
|
119 |
+
msgstr "10 (molto basso, il file piu piccolo)"
|
120 |
+
|
121 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:183
|
122 |
+
msgid "Generate Retina/HiDPI (@2x):"
|
123 |
+
msgstr "Genera Retina/HiDPI (@2x)"
|
124 |
+
|
125 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:188
|
126 |
+
msgid "The image has been cropped successfully"
|
127 |
+
msgstr "L'immagine č stata ritagliata con successo"
|
128 |
+
|
129 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:189
|
130 |
+
msgid "An Error has occured. Please try again or contact plugin's author."
|
131 |
+
msgstr "Si č verificato un errore. Prova di nuovo o contatta l'autore del plugin."
|
132 |
+
|
133 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:232
|
134 |
+
msgid "Compatible"
|
135 |
+
msgstr "compatibile"
|
136 |
+
|
137 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:234
|
138 |
+
msgid "Source too small"
|
139 |
+
msgstr "Fonte troppo piccolo"
|
140 |
+
|
141 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:125
|
142 |
+
msgid "Size"
|
143 |
+
msgstr "Dimensione"
|
144 |
+
|
145 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:126
|
146 |
+
msgid "Visible"
|
147 |
+
msgstr "Visibile"
|
148 |
+
|
149 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:127
|
150 |
+
msgid "Default JPEG Quality"
|
151 |
+
msgstr "Predefinito Qualita JPEG"
|
152 |
+
|
153 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:128
|
154 |
+
msgid "Custom Label"
|
155 |
+
msgstr "Etichetta personalizzata"
|
156 |
+
|
157 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:150
|
158 |
+
msgid "Yes"
|
159 |
+
msgstr "Si"
|
160 |
+
|
161 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:151
|
162 |
+
msgid "No"
|
163 |
+
msgstr "No"
|
languages/microp-pl_PL.mo
ADDED
Binary file
|
languages/microp-pl_PL.po
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: mic\n"
|
4 |
+
"POT-Creation-Date: 2014-05-13 22:40-0000\n"
|
5 |
+
"PO-Revision-Date: 2014-05-13 22:41-0000\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.7\n"
|
12 |
+
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SearchPath-0: C:\\wamp\\www\\wordpress\\wp-content\\plugins\\manual-"
|
15 |
+
"image-crop\n"
|
16 |
+
|
17 |
+
#: manual-image-crop/lib/ManualImageCrop.php:58
|
18 |
+
msgid "Crop"
|
19 |
+
msgstr "Kadruj"
|
20 |
+
|
21 |
+
#: manual-image-crop/lib/ManualImageCrop.php:67
|
22 |
+
msgid "Crop featured image"
|
23 |
+
msgstr "Kadruj główny obrazek"
|
24 |
+
|
25 |
+
#: manual-image-crop/lib/ManualImageCrop.php:94
|
26 |
+
#: manual-image-crop/lib/ManualImageCrop.php:121
|
27 |
+
msgid "Crop Image"
|
28 |
+
msgstr "Kadruj zdjęcie"
|
29 |
+
|
30 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:31
|
31 |
+
msgid "Pick the image size:"
|
32 |
+
msgstr "Wybierz rozmiar zdjęcia:"
|
33 |
+
|
34 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:41
|
35 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:115
|
36 |
+
msgid "Thumbnail"
|
37 |
+
msgstr "Miniatura"
|
38 |
+
|
39 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:42
|
40 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:116
|
41 |
+
msgid "Medium"
|
42 |
+
msgstr "Średnie"
|
43 |
+
|
44 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:43
|
45 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:117
|
46 |
+
msgid "Large"
|
47 |
+
msgstr "Duże"
|
48 |
+
|
49 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:44
|
50 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:118
|
51 |
+
msgid "Full Size"
|
52 |
+
msgstr "Pełny rozmiar"
|
53 |
+
|
54 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:142
|
55 |
+
msgid "Original picture dimensions:"
|
56 |
+
msgstr "Oryginalne wymiary:"
|
57 |
+
|
58 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
59 |
+
msgid "Target picture dimensions:"
|
60 |
+
msgstr "Docelowe wymairy:"
|
61 |
+
|
62 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
63 |
+
msgid "Soft proportional crop mode"
|
64 |
+
msgstr "Kadrowanie proporcjonalne"
|
65 |
+
|
66 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:143
|
67 |
+
msgid "Hard crop mode"
|
68 |
+
msgstr "Kadrowanie sztywne"
|
69 |
+
|
70 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:147
|
71 |
+
msgid "New image:"
|
72 |
+
msgstr "Nowe zdjęcie:"
|
73 |
+
|
74 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:154
|
75 |
+
msgid "Previous image:"
|
76 |
+
msgstr "Poprzednie zdjęcie:"
|
77 |
+
|
78 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:162
|
79 |
+
msgid "Crop it!"
|
80 |
+
msgstr "Kadruj!"
|
81 |
+
|
82 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:169
|
83 |
+
msgid "Target JPEG Quality"
|
84 |
+
msgstr "Jakość JPEG"
|
85 |
+
|
86 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:170
|
87 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:154
|
88 |
+
msgid "100 (best quality, biggest file)"
|
89 |
+
msgstr "100 (najlepsza jakość, największy plik)"
|
90 |
+
|
91 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:171
|
92 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:155
|
93 |
+
msgid "80 (very high quality)"
|
94 |
+
msgstr "80 (wyśmienita jakość)"
|
95 |
+
|
96 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:172
|
97 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:156
|
98 |
+
msgid "70 (high quality)"
|
99 |
+
msgstr "70 (bardzo wysoka jakość)"
|
100 |
+
|
101 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:173
|
102 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:157
|
103 |
+
msgid "60 (good)"
|
104 |
+
msgstr "60 (wysoka jakość)"
|
105 |
+
|
106 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:174
|
107 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:158
|
108 |
+
msgid "50 (average)"
|
109 |
+
msgstr "50 (średnia jakość)"
|
110 |
+
|
111 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:175
|
112 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:159
|
113 |
+
msgid "30 (low)"
|
114 |
+
msgstr "30 (niska jakość)"
|
115 |
+
|
116 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:176
|
117 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:160
|
118 |
+
msgid "10 (very low, smallest file)"
|
119 |
+
msgstr "10 (bardzo niska jakość)"
|
120 |
+
|
121 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:183
|
122 |
+
msgid "Generate Retina/HiDPI (@2x):"
|
123 |
+
msgstr "Wygeneruj Retina/HiDPI (@2x)"
|
124 |
+
|
125 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:188
|
126 |
+
msgid "The image has been cropped successfully"
|
127 |
+
msgstr "Zdjęcie zostało wykadrowane"
|
128 |
+
|
129 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:189
|
130 |
+
msgid "An Error has occured. Please try again or contact plugin's author."
|
131 |
+
msgstr "Wystąpił błąd, spróbuj ponownie lub skontaktuj się z autorem wtyczki"
|
132 |
+
|
133 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:232
|
134 |
+
msgid "Compatible"
|
135 |
+
msgstr "Kompatybilne"
|
136 |
+
|
137 |
+
#: manual-image-crop/lib/ManualImageCropEditorWindow.php:234
|
138 |
+
msgid "Source too small"
|
139 |
+
msgstr "Zbyt małe zdjecie wejściowe"
|
140 |
+
|
141 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:125
|
142 |
+
msgid "Size"
|
143 |
+
msgstr "Rozmiar"
|
144 |
+
|
145 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:126
|
146 |
+
msgid "Visible"
|
147 |
+
msgstr "Widoczny"
|
148 |
+
|
149 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:127
|
150 |
+
msgid "Default JPEG Quality"
|
151 |
+
msgstr "Domyślna jakość JPEG"
|
152 |
+
|
153 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:128
|
154 |
+
msgid "Custom Label"
|
155 |
+
msgstr "Niestandardowa etykieta"
|
156 |
+
|
157 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:150
|
158 |
+
msgid "Yes"
|
159 |
+
msgstr "Tak"
|
160 |
+
|
161 |
+
#: manual-image-crop/lib/ManualImageCropSettingsPage.php:151
|
162 |
+
msgid "No"
|
163 |
+
msgstr "Nie"
|
lib/ManualImageCrop.php
CHANGED
@@ -1,228 +1,278 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class responsible for all the logic
|
4 |
-
* @author tomasz
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class ManualImageCrop {
|
8 |
-
|
9 |
-
private static $instance;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Returns the instance of the class [Singleton]
|
13 |
-
* @return ManualImageCrop
|
14 |
-
*/
|
15 |
-
public static function getInstance() {
|
16 |
-
if (self::$instance === null) {
|
17 |
-
self::$instance = new ManualImageCrop();
|
18 |
-
}
|
19 |
-
return self::$instance;
|
20 |
-
}
|
21 |
-
|
22 |
-
private function __construct() {
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Enqueues all necessary CSS and Scripts
|
28 |
-
*/
|
29 |
-
public function enqueueAssets() {
|
30 |
-
add_thickbox();
|
31 |
-
|
32 |
-
wp_register_style( 'rct-admin', plugins_url('assets/css/mic-admin.css', dirname( __FILE__ ) ) );
|
33 |
-
wp_enqueue_style( 'rct-admin' );
|
34 |
-
|
35 |
-
wp_register_style( 'jquery-jcrop', plugins_url('assets/css/jquery.Jcrop.min.css', dirname( __FILE__ ) ) );
|
36 |
-
wp_enqueue_style( 'jquery-jcrop' );
|
37 |
-
|
38 |
-
wp_enqueue_script( 'jquery-color', plugins_url('assets/js/jquery.color.js', dirname( __FILE__ )), array( 'jquery') );
|
39 |
-
wp_enqueue_script( 'jquery-jcrop', plugins_url('assets/js/jquery.Jcrop.min.js', dirname( __FILE__ )), array( 'jquery') );
|
40 |
-
wp_enqueue_script( 'miccrop', plugins_url('assets/js/microp.js', dirname( __FILE__ )), array( 'jquery') );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Hooks Editor Links into proper places
|
45 |
-
*/
|
46 |
-
public function addEditorLinks() {
|
47 |
-
add_action( 'media_row_actions', array($this, 'addMediaEditorLinks'), 10, 2 );
|
48 |
-
add_action( 'admin_post_thumbnail_html', array($this, 'addCropFeatureImageEditorLink'), 10, 2 );
|
49 |
-
add_action( 'print_media_templates', array($this, 'addAttachementEditLink') );
|
50 |
-
add_action( 'admin_print_footer_scripts', array($this, 'addAfterUploadAttachementEditLink') );
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Adds links in media library list
|
55 |
-
*/
|
56 |
-
public function addMediaEditorLinks($links, $post) {
|
57 |
-
if (preg_match('/image/', $post->post_mime_type)) {
|
58 |
-
$links['crop'] = '<a class="thickbox mic-link" rel="crop" title="Manual Image Crop" href="' . admin_url( 'admin-ajax.php' ) . '?action=mic_editor_window&postId=' . $post->ID . '">Crop</a>';
|
59 |
-
}
|
60 |
-
return $links;
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Adds link below "
|
65 |
-
*/
|
66 |
-
public function addCropFeatureImageEditorLink($content, $post) {
|
67 |
-
$content .= '<a id="micCropFeatureImage" class="thickbox mic-link" rel="crop" title="Manual Image Crop" href="' . admin_url( 'admin-ajax.php' ) . '?action=mic_editor_window&postId=' . get_post_thumbnail_id($post) . '">Crop featured image</a>
|
68 |
-
<script>
|
69 |
-
setInterval(function() {
|
70 |
-
if (jQuery(\'#remove-post-thumbnail\').is(\':visible\')) {
|
71 |
-
jQuery(\'#micCropFeatureImage\').show();
|
72 |
-
}else {
|
73 |
-
jQuery(\'#micCropFeatureImage\').hide();
|
74 |
-
}
|
75 |
-
}, 200);
|
76 |
-
</script>';
|
77 |
-
return $content;
|
78 |
-
}
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Adds link in the ligthbox media library
|
82 |
-
*/
|
83 |
-
public function addAttachementEditLink() { ?>
|
84 |
-
<script>
|
85 |
-
var micEditAttachemtnLinkAdded = false;
|
86 |
-
var micEditAttachemtnLinkAddedInterval = 0;
|
87 |
-
jQuery(document).ready(function() {
|
88 |
-
micEditAttachemtnLinkAddedInterval = setInterval(function() {
|
89 |
-
if (jQuery('.details .edit-attachment').length) {
|
90 |
-
try {
|
91 |
-
var mRegexp = /\?post=([0-9]+)/;
|
92 |
-
var match = mRegexp.exec(jQuery('.details .edit-attachment').attr('href'));
|
93 |
-
jQuery('.crop-image-ml.crop-image').remove();
|
94 |
-
jQuery('.details .edit-attachment').after( '<a class="thickbox mic-link crop-image crop-image
|
95 |
-
} catch (e) {
|
96 |
-
console.log(e);
|
97 |
-
}
|
98 |
-
}
|
99 |
-
}, 500);
|
100 |
-
});
|
101 |
-
</script>
|
102 |
-
<?php
|
103 |
-
}
|
104 |
-
|
105 |
-
/**
|
106 |
-
* Adds link in the ligthbox media library
|
107 |
-
*/
|
108 |
-
public function addAfterUploadAttachementEditLink() {
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
}
|
133 |
-
|
134 |
-
/**
|
135 |
-
* Crops the image based on params passed in $_POST array
|
136 |
-
*/
|
137 |
-
public function cropImage() {
|
138 |
-
global $_wp_additional_image_sizes;
|
139 |
-
|
140 |
-
$uploadsDir = wp_upload_dir();
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
151 |
$dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
|
152 |
-
if (!$dst_file_url) {
|
153 |
-
echo json_encode (array('status' => 'error', 'message' => 'wrong size' ) );
|
154 |
-
exit;
|
155 |
-
}
|
156 |
-
$dst_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $dst_file_url[0]);
|
157 |
-
|
158 |
-
//checks if the destination image file is present (if it's not, we want to create a new file, as the WordPress returns the original image instead of specific one)
|
159 |
-
if ($dst_file == $src_file) {
|
160 |
-
$attachmentData = wp_generate_attachment_metadata( $_POST['attachmentId'], $dst_file );
|
161 |
-
|
162 |
-
//new destination file path - replaces original file name with the correct one
|
163 |
-
$dst_file = str_replace( basename($attachmentData['file']), $attachmentData['sizes'][ $_POST['editedSize'] ]['file'], $dst_file);
|
164 |
-
|
165 |
-
//saves new path to the image size in the database
|
166 |
-
wp_update_attachment_metadata( $_POST['attachmentId'], $attachmentData );
|
167 |
-
|
168 |
-
//retirives the new url to file (needet to refresh the preview)
|
169 |
-
$dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
|
170 |
-
}
|
171 |
-
|
172 |
-
//sets the destination image dimensions
|
173 |
-
if (isset($_wp_additional_image_sizes[$_POST['editedSize']])) {
|
174 |
-
$dst_w = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['width']), $_POST['select']['w'] * $_POST['previewScale']);;
|
175 |
-
$dst_h = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['height']), $_POST['select']['h'] * $_POST['previewScale']);
|
176 |
-
} else {
|
177 |
-
$dst_w = min(get_option($_POST['editedSize'].'_size_w'), $_POST['select']['w'] * $_POST['previewScale']);
|
178 |
-
$dst_h = min(get_option($_POST['editedSize'].'_size_h'), $_POST['select']['h'] * $_POST['previewScale']);
|
179 |
-
}
|
180 |
|
181 |
-
if (!$
|
182 |
-
echo json_encode (array('status' => 'error', 'message' => 'wrong dimensions' ) );
|
183 |
exit;
|
184 |
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
$
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
$
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
//
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class responsible for all the logic
|
4 |
+
* @author tomasz
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class ManualImageCrop {
|
8 |
+
|
9 |
+
private static $instance;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Returns the instance of the class [Singleton]
|
13 |
+
* @return ManualImageCrop
|
14 |
+
*/
|
15 |
+
public static function getInstance() {
|
16 |
+
if (self::$instance === null) {
|
17 |
+
self::$instance = new ManualImageCrop();
|
18 |
+
}
|
19 |
+
return self::$instance;
|
20 |
+
}
|
21 |
+
|
22 |
+
private function __construct() {
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Enqueues all necessary CSS and Scripts
|
28 |
+
*/
|
29 |
+
public function enqueueAssets() {
|
30 |
+
add_thickbox();
|
31 |
+
|
32 |
+
wp_register_style( 'rct-admin', plugins_url('assets/css/mic-admin.css', dirname( __FILE__ ) ) );
|
33 |
+
wp_enqueue_style( 'rct-admin' );
|
34 |
+
|
35 |
+
wp_register_style( 'jquery-jcrop', plugins_url('assets/css/jquery.Jcrop.min.css', dirname( __FILE__ ) ) );
|
36 |
+
wp_enqueue_style( 'jquery-jcrop' );
|
37 |
+
|
38 |
+
wp_enqueue_script( 'jquery-color', plugins_url('assets/js/jquery.color.js', dirname( __FILE__ )), array( 'jquery') );
|
39 |
+
wp_enqueue_script( 'jquery-jcrop', plugins_url('assets/js/jquery.Jcrop.min.js', dirname( __FILE__ )), array( 'jquery') );
|
40 |
+
wp_enqueue_script( 'miccrop', plugins_url('assets/js/microp.js', dirname( __FILE__ )), array( 'jquery') );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Hooks Editor Links into proper places
|
45 |
+
*/
|
46 |
+
public function addEditorLinks() {
|
47 |
+
add_action( 'media_row_actions', array($this, 'addMediaEditorLinks'), 10, 2 );
|
48 |
+
add_action( 'admin_post_thumbnail_html', array($this, 'addCropFeatureImageEditorLink'), 10, 2 );
|
49 |
+
add_action( 'print_media_templates', array($this, 'addAttachementEditLink') );
|
50 |
+
add_action( 'admin_print_footer_scripts', array($this, 'addAfterUploadAttachementEditLink') );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Adds links in media library list
|
55 |
+
*/
|
56 |
+
public function addMediaEditorLinks($links, $post) {
|
57 |
+
if (preg_match('/image/', $post->post_mime_type)) {
|
58 |
+
$links['crop'] = '<a class="thickbox mic-link" rel="crop" title="Manual Image Crop" href="' . admin_url( 'admin-ajax.php' ) . '?action=mic_editor_window&postId=' . $post->ID . '">' . __('Crop','microp') . '</a>';
|
59 |
+
}
|
60 |
+
return $links;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Adds link below "Remove featured image" in post editing form
|
65 |
+
*/
|
66 |
+
public function addCropFeatureImageEditorLink($content, $post) {
|
67 |
+
$content .= '<a id="micCropFeatureImage" class="thickbox mic-link" rel="crop" title="Manual Image Crop" href="' . admin_url( 'admin-ajax.php' ) . '?action=mic_editor_window&postId=' . get_post_thumbnail_id($post) . '">' . __('Crop featured image','microp') . '</a>
|
68 |
+
<script>
|
69 |
+
setInterval(function() {
|
70 |
+
if (jQuery(\'#remove-post-thumbnail\').is(\':visible\')) {
|
71 |
+
jQuery(\'#micCropFeatureImage\').show();
|
72 |
+
}else {
|
73 |
+
jQuery(\'#micCropFeatureImage\').hide();
|
74 |
+
}
|
75 |
+
}, 200);
|
76 |
+
</script>';
|
77 |
+
return $content;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Adds link in the ligthbox media library
|
82 |
+
*/
|
83 |
+
public function addAttachementEditLink() { ?>
|
84 |
+
<script>
|
85 |
+
var micEditAttachemtnLinkAdded = false;
|
86 |
+
var micEditAttachemtnLinkAddedInterval = 0;
|
87 |
+
jQuery(document).ready(function() {
|
88 |
+
micEditAttachemtnLinkAddedInterval = setInterval(function() {
|
89 |
+
if (jQuery('.details .edit-attachment').length) {
|
90 |
+
try {
|
91 |
+
var mRegexp = /\?post=([0-9]+)/;
|
92 |
+
var match = mRegexp.exec(jQuery('.details .edit-attachment').attr('href'));
|
93 |
+
jQuery('.crop-image-ml.crop-image').remove();
|
94 |
+
jQuery('.details .edit-attachment').after( '<a class="thickbox mic-link crop-image-ml crop-image" rel="crop" title="Manual Image Crop" href="' + ajaxurl + '?action=mic_editor_window&postId=' + match[1] + '"><?php _e('Crop Image','microp') ?></a>' );
|
95 |
+
} catch (e) {
|
96 |
+
console.log(e);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}, 500);
|
100 |
+
});
|
101 |
+
</script>
|
102 |
+
<?php
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Adds link in the ligthbox media library
|
107 |
+
*/
|
108 |
+
public function addAfterUploadAttachementEditLink() {
|
109 |
+
?>
|
110 |
+
<script>
|
111 |
+
var micEditAttachemtnLinkAdded = false;
|
112 |
+
var micEditAttachemtnLinkAddedInterval = 0;
|
113 |
+
jQuery(document).ready(function() {
|
114 |
+
micEditAttachemtnLinkAddedInterval = setInterval(function() {
|
115 |
+
if (jQuery('#media-items .edit-attachment').length) {
|
116 |
+
jQuery('#media-items .edit-attachment').each(function(i, k) {
|
117 |
+
try {
|
118 |
+
var mRegexp = /\?post=([0-9]+)/;
|
119 |
+
var match = mRegexp.exec(jQuery(this).attr('href'));
|
120 |
+
if (!jQuery(this).parent().find('.edit-attachment.crop-image').length && jQuery(this).parent().find('.pinkynail').attr('src').match(/upload/g)) {
|
121 |
+
jQuery(this).after( '<a class="thickbox mic-link edit-attachment crop-image" rel="crop" title="Manual Image Crop" href="' + ajaxurl + '?action=mic_editor_window&postId=' + match[1] + '"><?php _e('Crop Image','microp') ?></a>' );
|
122 |
+
}
|
123 |
+
} catch (e) {
|
124 |
+
console.log(e);
|
125 |
+
}
|
126 |
+
});
|
127 |
+
}
|
128 |
+
}, 500);
|
129 |
+
});
|
130 |
+
</script>
|
131 |
+
<?php
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Crops the image based on params passed in $_POST array
|
136 |
+
*/
|
137 |
+
public function cropImage() {
|
138 |
+
global $_wp_additional_image_sizes;
|
139 |
+
|
140 |
+
$uploadsDir = wp_upload_dir();
|
141 |
+
|
142 |
+
// checks for ssl. wp_upload_dir does not handle ssl (ssl admin trips on this and subsequent ajax success to browser)
|
143 |
+
if (is_ssl()) {
|
144 |
+
$uploadsDir['baseurl'] = preg_replace('#^http://#i', 'https://', $uploadsDir['baseurl']);
|
145 |
+
}
|
146 |
+
|
147 |
+
$src_file_url = wp_get_attachment_image_src($_POST['attachmentId'], 'full');
|
148 |
+
|
149 |
+
if (!$src_file_url) {
|
150 |
+
echo json_encode (array('status' => 'error', 'message' => 'wrong attachment' ) );
|
151 |
+
exit;
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
$src_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $src_file_url[0]);
|
156 |
$dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
+
if (!$dst_file_url) {
|
|
|
159 |
exit;
|
160 |
}
|
161 |
+
$dst_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $dst_file_url[0]);
|
162 |
+
|
163 |
+
|
164 |
+
//checks if the destination image file is present (if it's not, we want to create a new file, as the WordPress returns the original image instead of specific one)
|
165 |
+
if ($dst_file == $src_file) {
|
166 |
+
$attachmentData = wp_generate_attachment_metadata( $_POST['attachmentId'], $dst_file );
|
167 |
+
|
168 |
+
//new destination file path - replaces original file name with the correct one
|
169 |
+
$dst_file = str_replace( basename($attachmentData['file']), $attachmentData['sizes'][ $_POST['editedSize'] ]['file'], $dst_file);
|
170 |
+
|
171 |
+
//saves new path to the image size in the database
|
172 |
+
wp_update_attachment_metadata( $_POST['attachmentId'], $attachmentData );
|
173 |
+
|
174 |
+
//retrieves the new url to file (needet to refresh the preview)
|
175 |
+
$dst_file_url = wp_get_attachment_image_src($_POST['attachmentId'], $_POST['editedSize']);
|
176 |
+
}
|
177 |
+
|
178 |
+
//sets the destination image dimensions
|
179 |
+
if (isset($_wp_additional_image_sizes[$_POST['editedSize']])) {
|
180 |
+
$dst_w = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['width']), $_POST['select']['w'] * $_POST['previewScale']);;
|
181 |
+
$dst_h = min(intval($_wp_additional_image_sizes[$_POST['editedSize']]['height']), $_POST['select']['h'] * $_POST['previewScale']);
|
182 |
+
} else {
|
183 |
+
$dst_w = min(get_option($_POST['editedSize'].'_size_w'), $_POST['select']['w'] * $_POST['previewScale']);
|
184 |
+
$dst_h = min(get_option($_POST['editedSize'].'_size_h'), $_POST['select']['h'] * $_POST['previewScale']);
|
185 |
+
}
|
186 |
+
|
187 |
+
if (!$dst_w || !$dst_h) {
|
188 |
+
echo json_encode (array('status' => 'error', 'message' => 'wrong dimensions' ) );
|
189 |
+
exit;
|
190 |
+
}
|
191 |
+
|
192 |
+
//prepares coordinates that will be passed to cropping function
|
193 |
+
$dst_x = 0;
|
194 |
+
$dst_y = 0;
|
195 |
+
$src_x = max(0, $_POST['select']['x']) * $_POST['previewScale'];
|
196 |
+
$src_y = max(0, $_POST['select']['y']) * $_POST['previewScale'];
|
197 |
+
$src_w = max(0, $_POST['select']['w']) * $_POST['previewScale'];
|
198 |
+
$src_h = max(0, $_POST['select']['h']) * $_POST['previewScale'];
|
199 |
+
|
200 |
+
//saves the selected area
|
201 |
+
$imageMetadata = wp_get_attachment_metadata($_POST['attachmentId']);
|
202 |
+
$imageMetadata['micSelectedArea'][$_POST['editedSize']] = array(
|
203 |
+
'x' => $_POST['select']['x'],
|
204 |
+
'y' => $_POST['select']['y'],
|
205 |
+
'w' => $_POST['select']['w'],
|
206 |
+
'h' => $_POST['select']['h'],
|
207 |
+
);
|
208 |
+
wp_update_attachment_metadata($_POST['attachmentId'], $imageMetadata);
|
209 |
+
|
210 |
+
$quality = intval($_POST['mic_quality']);
|
211 |
+
|
212 |
+
if ( function_exists('wp_get_image_editor') ) {
|
213 |
+
$img = wp_get_image_editor( $src_file );
|
214 |
+
if ( ! is_wp_error( $img ) ) {
|
215 |
+
$img->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, false );
|
216 |
+
$img->set_quality( $quality );
|
217 |
+
$img->save($dst_file);
|
218 |
+
}
|
219 |
+
} else {
|
220 |
+
//determines what's the image format
|
221 |
+
$ext = pathinfo($src_file, PATHINFO_EXTENSION);
|
222 |
+
if ($ext == "gif"){
|
223 |
+
$src_img = imagecreatefromgif($src_file);
|
224 |
+
} else if($ext =="png"){
|
225 |
+
$src_img = imagecreatefrompng($src_file);
|
226 |
+
} else {
|
227 |
+
$src_img = imagecreatefromjpeg($src_file);
|
228 |
+
}
|
229 |
+
$dst_img = imagecreatetruecolor($dst_w, $dst_h);
|
230 |
+
imagecopyresampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
231 |
+
|
232 |
+
if ($ext == "gif"){
|
233 |
+
imagegif($dst_img, $dst_file);
|
234 |
+
} else if($ext =="png"){
|
235 |
+
imagepng($dst_img, $dst_file);
|
236 |
+
} else {
|
237 |
+
imagejpeg($dst_img, $dst_file, $quality);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
// Generate Retina Image
|
242 |
+
if($_POST['make2x'] === 'true') {
|
243 |
+
$dst_w2x = $dst_w * 2;
|
244 |
+
$dst_h2x = $dst_h * 2;
|
245 |
+
|
246 |
+
$dot = strrpos($dst_file,".");
|
247 |
+
$dst_file2x = substr($dst_file,0,$dot).'@2x'.substr($dst_file,$dot);
|
248 |
+
|
249 |
+
// Check image size and create the retina file if possible
|
250 |
+
if ( $src_w > $dst_w2x && $src_h > $dst_h2x) {
|
251 |
+
if ( function_exists('wp_get_image_editor') ) {
|
252 |
+
$img = wp_get_image_editor( $src_file );
|
253 |
+
if ( ! is_wp_error( $img ) ) {
|
254 |
+
$img->crop( $src_x, $src_y, $src_w, $src_h, $dst_w2x, $dst_h2x, false );
|
255 |
+
$img->set_quality( $quality );
|
256 |
+
$img->save($dst_file2x);
|
257 |
+
}
|
258 |
+
} else {
|
259 |
+
$dst_img2x = imagecreatetruecolor($dst_w2x, $dst_h2x);
|
260 |
+
imagecopyresampled($dst_img2x, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w2x, $dst_h2x, $src_w, $src_h);
|
261 |
+
if ($ext == "gif"){
|
262 |
+
imagegif($dst_img2x, $dst_file2x);
|
263 |
+
} else if($ext =="png"){
|
264 |
+
imagepng($dst_img2x, $dst_file2x);
|
265 |
+
} else {
|
266 |
+
imagejpeg($dst_img2x, $dst_file2x, $quality);
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
// update 'mic_make2x' option status to persist choice
|
272 |
+
if($_POST['make2x'] !== get_option('mic_make2x')) update_option('mic_make2x', $_POST['make2x']);
|
273 |
+
|
274 |
+
//returns the url to the generated image (to allow refreshing the preview)
|
275 |
+
echo json_encode (array('status' => 'ok', 'file' => $dst_file_url[0] . '?' . time() ) );
|
276 |
+
exit;
|
277 |
+
}
|
278 |
+
}
|
lib/ManualImageCropEditorWindow.php
CHANGED
@@ -1,186 +1,243 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class responsible for rendering the cropping Window
|
4 |
-
* @author tomasz
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
class ManualImageCropEditorWindow {
|
8 |
-
|
9 |
-
private static $instance;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Returns the instance of the class [Singleton]
|
13 |
-
* @return ManualImageCropEditorWindow
|
14 |
-
*/
|
15 |
-
public static function getInstance() {
|
16 |
-
if (self::$instance === null) {
|
17 |
-
self::$instance = new ManualImageCropEditorWindow();
|
18 |
-
}
|
19 |
-
return self::$instance;
|
20 |
-
}
|
21 |
-
|
22 |
-
private function __construct() {
|
23 |
-
|
24 |
-
}
|
25 |
-
|
26 |
-
public function renderWindow() {
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
if (
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
$
|
59 |
-
|
60 |
-
$cropMethod = get_option($
|
61 |
-
}
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
$
|
82 |
-
|
83 |
-
$
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
$
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
<
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class responsible for rendering the cropping Window
|
4 |
+
* @author tomasz
|
5 |
+
*
|
6 |
+
*/
|
7 |
+
class ManualImageCropEditorWindow {
|
8 |
+
|
9 |
+
private static $instance;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Returns the instance of the class [Singleton]
|
13 |
+
* @return ManualImageCropEditorWindow
|
14 |
+
*/
|
15 |
+
public static function getInstance() {
|
16 |
+
if (self::$instance === null) {
|
17 |
+
self::$instance = new ManualImageCropEditorWindow();
|
18 |
+
}
|
19 |
+
return self::$instance;
|
20 |
+
}
|
21 |
+
|
22 |
+
private function __construct() {
|
23 |
+
|
24 |
+
}
|
25 |
+
|
26 |
+
public function renderWindow() {
|
27 |
+
$sizes_settings = get_option( 'mic_options' );
|
28 |
+
$sizesSettings = unserialize( $sizes_settings['sizes_settings'] );
|
29 |
+
?>
|
30 |
+
<div class="mic-editor-wrapper">
|
31 |
+
<h4><?php _e('Pick the image size:','microp'); ?></h4>
|
32 |
+
<h2 class="nav-tab-wrapper">
|
33 |
+
<?php
|
34 |
+
global $_wp_additional_image_sizes;
|
35 |
+
|
36 |
+
$imageSizes = get_intermediate_image_sizes();
|
37 |
+
|
38 |
+
$editedSize = isset( $_GET['size'] ) ? $_GET['size'] : $imageSizes[0];
|
39 |
+
|
40 |
+
$sizeLabels = apply_filters( 'image_size_names_choose', array(
|
41 |
+
'thumbnail' => __('Thumbnail'),
|
42 |
+
'medium' => __('Medium'),
|
43 |
+
'large' => __('Large'),
|
44 |
+
'full' => __('Full Size'),
|
45 |
+
) );
|
46 |
+
$sizeLabels = apply_filters( 'image_size_names_choose', array() );
|
47 |
+
|
48 |
+
foreach ($imageSizes as $s) {
|
49 |
+
if (! $sizesSettings[$s] ) {
|
50 |
+
$sizesSettings[$s] = array('label' => '', 'quality' => 80, 'visibility' => 'visible');
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( $sizesSettings[$s]['visibility'] == 'hidden') {
|
54 |
+
continue;
|
55 |
+
}
|
56 |
+
|
57 |
+
if (isset($_wp_additional_image_sizes[$s])) {
|
58 |
+
$cropMethod = $_wp_additional_image_sizes[$s]['crop'];
|
59 |
+
} else {
|
60 |
+
$cropMethod = get_option($s.'_crop');
|
61 |
+
}
|
62 |
+
if ($cropMethod == 0) {
|
63 |
+
continue;
|
64 |
+
}
|
65 |
+
|
66 |
+
// Get user defined label for the size or just cleanup a bit
|
67 |
+
$label = isset($sizeLabels[$s]) ? $sizeLabels[$s] : ucfirst( str_replace( '-', ' ', $s ) );
|
68 |
+
$label = $sizesSettings[$s]['label'] ? $sizesSettings[$s]['label'] : $label;
|
69 |
+
echo '<a href="' . admin_url( 'admin-ajax.php' ) . '?action=mic_editor_window&size=' . $s . '&postId=' . $_GET['postId'] . '&width=940" class="mic-icon-' . $s . ' rm-crop-size-tab nav-tab ' . ( ($s == $editedSize) ? 'nav-tab-active' : '' ) . '">' . $label . '</a>';
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</h2>
|
73 |
+
<div class="mic-left-col">
|
74 |
+
<?php
|
75 |
+
//reads the specific registered image size dimension
|
76 |
+
if (isset($_wp_additional_image_sizes[$editedSize])) {
|
77 |
+
$width = intval($_wp_additional_image_sizes[$editedSize]['width']);
|
78 |
+
$height = intval($_wp_additional_image_sizes[$editedSize]['height']);
|
79 |
+
$cropMethod = $_wp_additional_image_sizes[$editedSize]['crop'];
|
80 |
+
} else {
|
81 |
+
$width = get_option($editedSize.'_size_w');
|
82 |
+
$height = get_option($editedSize.'_size_h');
|
83 |
+
$cropMethod = get_option($editedSize.'_crop');
|
84 |
+
}
|
85 |
+
|
86 |
+
$uploadsDir = wp_upload_dir();
|
87 |
+
|
88 |
+
$metaData = wp_get_attachment_metadata($_GET['postId']);
|
89 |
+
|
90 |
+
$src_file_url = wp_get_attachment_image_src($_GET['postId'], 'full');
|
91 |
+
if (!$src_file_url) {
|
92 |
+
echo json_encode (array('status' => 'error', 'message' => 'wrong attachement' ) );
|
93 |
+
exit;
|
94 |
+
}
|
95 |
+
$src_file = str_replace($uploadsDir['baseurl'], $uploadsDir['basedir'], $src_file_url[0]);
|
96 |
+
$sizes = getimagesize($src_file);
|
97 |
+
|
98 |
+
$previewWidth = min($sizes[0], 500);
|
99 |
+
$previewHeight = min($sizes[1], 350);
|
100 |
+
$previewRatio = 1;
|
101 |
+
|
102 |
+
if ($sizes[1] / 350 < $sizes[0] / 500) {
|
103 |
+
$previewHeight = $sizes[1] * $previewWidth / $sizes[0] ;
|
104 |
+
$previewRatio = $sizes[1] / $previewHeight;
|
105 |
+
}else {
|
106 |
+
$previewWidth = $sizes[0] * $previewHeight / $sizes[1];
|
107 |
+
$previewRatio = $sizes[0] / $previewWidth;
|
108 |
+
}
|
109 |
+
|
110 |
+
$minWidth = min($width / $previewRatio, $previewWidth);
|
111 |
+
$minHeight = min($height / $previewRatio, $previewHeight);
|
112 |
+
|
113 |
+
if ($cropMethod == 1) {
|
114 |
+
$aspectRatio = ($width / $height);
|
115 |
+
if ($aspectRatio * $minWidth > $sizes[0]) {
|
116 |
+
$aspectRatio = ($previewWidth / $minHeight);
|
117 |
+
}else if (1 / $aspectRatio * $minHeight > $sizes[1]) {
|
118 |
+
$aspectRatio = ($minWidth / $previewHeight);
|
119 |
+
}
|
120 |
+
|
121 |
+
if ($minWidth / $aspectRatio > $previewHeight) {
|
122 |
+
$aspectRatio = $minWidth / $previewHeight;
|
123 |
+
}
|
124 |
+
}else {
|
125 |
+
$aspectRatio = $sizes[0] / $sizes[1];
|
126 |
+
}
|
127 |
+
|
128 |
+
|
129 |
+
$smallPreviewWidth = min($width, 180);
|
130 |
+
$smallPreviewHeight = min($height, 180);
|
131 |
+
|
132 |
+
if ($width > $height) {
|
133 |
+
$smallPreviewHeight = $smallPreviewWidth * 1/ $aspectRatio;
|
134 |
+
}else {
|
135 |
+
$smallPreviewWidth = $smallPreviewHeight * $aspectRatio;
|
136 |
+
}
|
137 |
+
?>
|
138 |
+
<div style="margin: auto; width: <?php echo $previewWidth; ?>px;"><img style="width: <?php echo $previewWidth; ?>px; height: <?php echo $previewHeight; ?>px;" id="jcrop_target" src="<?php echo wp_get_attachment_url($_GET['postId']); ?>"></div>
|
139 |
+
</div>
|
140 |
+
<div class="mic-right-col">
|
141 |
+
<div>
|
142 |
+
<?php _e('Original picture dimensions:','microp') ?> <strong><?php echo $sizes[0]; ?> x <?php echo $sizes[1]; ?> px</strong><br />
|
143 |
+
<?php _e('Target picture dimensions:','microp') ?> <strong><?php echo $width; ?>px x <?php echo $height; ?>px</strong> (<?php if ($cropMethod == 0) { _e('Soft proportional crop mode','microp'); }else { _e('Hard crop mode','microp'); } ?>)
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<div class="mic-52-col">
|
147 |
+
<?php _e('New image:','microp') ?><br />
|
148 |
+
<div style="width: <?php echo $smallPreviewWidth; ?>px; height: <?php echo $smallPreviewHeight; ?>px; overflow: hidden; margin-left: 5px; float: right;">
|
149 |
+
<img id="preview" src="<?php echo wp_get_attachment_url($_GET['postId']); ?>">
|
150 |
+
</div>
|
151 |
+
</div>
|
152 |
+
|
153 |
+
<div class="mic-48-col">
|
154 |
+
<?php _e('Previous image:','microp');
|
155 |
+
$editedImage = wp_get_attachment_image_src($_GET['postId'], $editedSize);
|
156 |
+
?>
|
157 |
+
<div style="width: <?php echo $smallPreviewWidth; ?>px; height: <?php echo $smallPreviewHeight; ?>px; overflow: hidden; margin-left: 5px;">
|
158 |
+
<img id="micPreviousImage" style="max-width: <?php echo $smallPreviewWidth; ?>px; max-height: <?php echo $smallPreviewHeight; ?>px;" src="<?php echo $editedImage[0] . '?' . time(); ?>">
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
|
162 |
+
<input id="micCropImage" class="button-primary button-large" type="button" value="<?php _e('Crop it!','microp') ?>" />
|
163 |
+
<img src="<?php echo includes_url(); ?>js/thickbox/loadingAnimation.gif" id="micLoading" />
|
164 |
+
|
165 |
+
|
166 |
+
<?php
|
167 |
+
$ext = strtolower( pathinfo($src_file, PATHINFO_EXTENSION) );
|
168 |
+
if ($ext == 'jpg' || $ext == 'jpeg') {
|
169 |
+
echo '<div class="mic-option"><label for="micQuality">' . __('Target JPEG Quality', 'microp') . '</label> <select id="micQuality" name="mic_quality">
|
170 |
+
<option value="100">' . __('100 (best quality, biggest file)', 'microp') . '</option>
|
171 |
+
<option value="80" ' . ( $sizesSettings[$editedSize]['quality'] == '80' ? 'selected' : '' ) . '>' . __('80 (very high quality)', 'microp') . '</option>
|
172 |
+
<option value="70" ' . ( $sizesSettings[$editedSize]['quality'] == '70' ? 'selected' : '' ) . '>' . __('70 (high quality)', 'microp') . '</option>
|
173 |
+
<option value="60" ' . ( $sizesSettings[$editedSize]['quality'] == '60' ? 'selected' : '' ) . '>' . __('60 (good)', 'microp') . '</option>
|
174 |
+
<option value="50" ' . ( $sizesSettings[$editedSize]['quality'] == '50' ? 'selected' : '' ) . '>' . __('50 (average)', 'microp') . '</option>
|
175 |
+
<option value="30" ' . ( $sizesSettings[$editedSize]['quality'] == '30' ? 'selected' : '' ) . '>' . __('30 (low)', 'microp') . '</option>
|
176 |
+
<option value="10" ' . ( $sizesSettings[$editedSize]['quality'] == '10' ? 'selected' : '' ) . '>' . __('10 (very low, smallest file)', 'microp') . '</option>
|
177 |
+
</select></div>';
|
178 |
+
}
|
179 |
+
?>
|
180 |
+
<?php
|
181 |
+
if ( is_plugin_active('wp-retina-2x/wp-retina-2x.php') ) { ?>
|
182 |
+
<div class="mic-option">
|
183 |
+
<input type="checkbox" id="mic-make-2x" <?php if(get_option('mic_make2x') === 'true' ) echo 'checked="checked"' ?> /> <label for="mic-make-2x"><?php _e('Generate Retina/HiDPI (@2x):', 'microp') ?> <span id="mic-2x-status"></span></label>
|
184 |
+
</div>
|
185 |
+
<?php
|
186 |
+
} ?>
|
187 |
+
|
188 |
+
<div id="micSuccessMessage" class="updated below-h2"><?php _e('The image has been cropped successfully','microp') ?></div>
|
189 |
+
<div id="micFailureMessage" class="error below-h2"><?php _e('An Error has occured. Please try again or contact plugin\'s author.','microp') ?></div>
|
190 |
+
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
<script>
|
194 |
+
jQuery(document).ready(function($) {
|
195 |
+
mic_attachment_id = <?php echo $_GET['postId']; ?>;
|
196 |
+
mic_edited_size = '<?php echo $editedSize; ?>';
|
197 |
+
mic_preview_scale = <?php echo $previewRatio; ?>;
|
198 |
+
|
199 |
+
$('#mic-make-2x').change(function() {$('#mic-2x-status').toggle()});
|
200 |
+
|
201 |
+
|
202 |
+
setTimeout(function() {
|
203 |
+
$('#jcrop_target').Jcrop({
|
204 |
+
onChange: showPreview,
|
205 |
+
onSelect: showPreview,
|
206 |
+
minSize: [<?php echo $minWidth; ?>, <?php echo $minHeight; ?>],
|
207 |
+
maxSize: [<?php echo $previewWidth; ?>, <?php echo $previewHeight; ?>],
|
208 |
+
<?php if ( isset( $metaData['micSelectedArea'][$editedSize] ) ) { ?>
|
209 |
+
setSelect: [<?php echo max(0, $metaData['micSelectedArea'][$editedSize]['x']) ?>, <?php echo max(0, $metaData['micSelectedArea'][$editedSize]['y']) ?>, <?php echo max(0, $metaData['micSelectedArea'][$editedSize]['x']) + $metaData['micSelectedArea'][$editedSize]['w']; ?>, <?php echo max(0, $metaData['micSelectedArea'][$editedSize]['y']) + $metaData['micSelectedArea'][$editedSize]['h']; ?>],
|
210 |
+
<?php }else { ?>
|
211 |
+
setSelect: [<?php echo max(0, ($previewWidth - ($previewHeight * $aspectRatio)) / 2) ?>, <?php echo max(0, ($previewHeight - ($previewWidth / $aspectRatio)) / 2) ?>, <?php echo $previewWidth * $aspectRatio; ?>, <?php echo $previewHeight; ?>],
|
212 |
+
<?php }?>
|
213 |
+
aspectRatio: <?php echo $aspectRatio; ?>,
|
214 |
+
}, function() {
|
215 |
+
jcrop_api = this;
|
216 |
+
});
|
217 |
+
}, 300);
|
218 |
+
|
219 |
+
function showPreview(coords) {
|
220 |
+
var rx = <?php echo $smallPreviewWidth; ?> / coords.w;
|
221 |
+
var ry = <?php echo $smallPreviewHeight; ?> / coords.h;
|
222 |
+
|
223 |
+
$('#preview').css({
|
224 |
+
width: Math.round(rx * <?php echo $previewWidth; ?>)+ 'px',
|
225 |
+
height: Math.round(ry * <?php echo $previewHeight; ?>) + 'px',
|
226 |
+
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
|
227 |
+
marginTop: '-' + Math.round(ry * coords.y) + 'px'
|
228 |
+
});
|
229 |
+
|
230 |
+
var mic_2xok = Math.round(coords.w*mic_preview_scale) > (<?php echo $width; ?> * 2);
|
231 |
+
if(mic_2xok === true) {
|
232 |
+
$('#mic-2x-status').toggleClass('mic-ok', mic_2xok).html("<?php _e('Compatible', 'microp') ?>");
|
233 |
+
} else {
|
234 |
+
$('#mic-2x-status').toggleClass('mic-ok', mic_2xok).html("<?php _e('Source too small', 'microp') ?>");
|
235 |
+
}
|
236 |
+
if($('#mic-make-2x').prop('checked')) $('#mic-2x-status').show();
|
237 |
+
}
|
238 |
+
});
|
239 |
+
</script>
|
240 |
+
<?php
|
241 |
+
die;
|
242 |
+
}
|
243 |
+
}
|
lib/ManualImageCropSettingsPage.php
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class MicSettingsPage
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Holds the values to be used in the fields callbacks
|
6 |
+
*/
|
7 |
+
private $options;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Start up
|
11 |
+
*/
|
12 |
+
public function __construct()
|
13 |
+
{
|
14 |
+
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
15 |
+
add_action( 'admin_init', array( $this, 'page_init' ) );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Add options page
|
20 |
+
*/
|
21 |
+
public function add_plugin_page()
|
22 |
+
{
|
23 |
+
// This page will be under "Settings"
|
24 |
+
add_options_page(
|
25 |
+
'Settings Admin',
|
26 |
+
'Manual Image Crop',
|
27 |
+
'manage_options',
|
28 |
+
'Mic-setting-admin',
|
29 |
+
array( $this, 'create_admin_page' )
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Options page callback
|
35 |
+
*/
|
36 |
+
public function create_admin_page()
|
37 |
+
{
|
38 |
+
// Set class property
|
39 |
+
$this->options = get_option( 'mic_options' );
|
40 |
+
?>
|
41 |
+
<div class="wrap">
|
42 |
+
<?php screen_icon(); ?>
|
43 |
+
<h2>Manual Image Crop Settings</h2>
|
44 |
+
<form method="post" action="options.php" class="mic-settings-page">
|
45 |
+
<?php
|
46 |
+
// This prints out all hidden setting fields
|
47 |
+
settings_fields( 'mic_options_group' );
|
48 |
+
do_settings_sections( 'Mic-setting-admin' );
|
49 |
+
submit_button();
|
50 |
+
?>
|
51 |
+
</form>
|
52 |
+
</div>
|
53 |
+
<?php
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Register and add settings
|
58 |
+
*/
|
59 |
+
public function page_init()
|
60 |
+
{
|
61 |
+
register_setting(
|
62 |
+
'mic_options_group', // Option group
|
63 |
+
'mic_options', // Option name
|
64 |
+
array( $this, 'sanitize' ) // Sanitize
|
65 |
+
);
|
66 |
+
|
67 |
+
add_settings_section(
|
68 |
+
'setting_section_id', // ID
|
69 |
+
'Mic Custom Settings', // Title
|
70 |
+
array( $this, 'print_section_info' ), // Callback
|
71 |
+
'Mic-setting-admin' // Page
|
72 |
+
);
|
73 |
+
|
74 |
+
add_settings_field(
|
75 |
+
'sizes_settings', // ID
|
76 |
+
'Crop sizes settings', // Title
|
77 |
+
array( $this, 'sizes_settings_callback' ), // Callback
|
78 |
+
'Mic-setting-admin', // Page
|
79 |
+
'setting_section_id' // Section
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Sanitize each setting field as needed
|
85 |
+
*
|
86 |
+
* @param array $input Contains all settings fields as array keys
|
87 |
+
*/
|
88 |
+
public function sanitize( $input )
|
89 |
+
{
|
90 |
+
$new_input = array();
|
91 |
+
if( isset( $input['sizes_settings'] ) )
|
92 |
+
$new_input['sizes_settings'] = serialize( $input['sizes_settings'] );
|
93 |
+
|
94 |
+
return $new_input;
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Print the Section text
|
99 |
+
*/
|
100 |
+
public function print_section_info()
|
101 |
+
{
|
102 |
+
print 'Enter your settings below:';
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Get the settings option array and print one of its values
|
107 |
+
*/
|
108 |
+
public function sizes_settings_callback()
|
109 |
+
{
|
110 |
+
global $_wp_additional_image_sizes;
|
111 |
+
|
112 |
+
$imageSizes = get_intermediate_image_sizes();
|
113 |
+
|
114 |
+
$sizeLabels = apply_filters( 'image_size_names_choose', array(
|
115 |
+
'thumbnail' => __('Thumbnail'),
|
116 |
+
'medium' => __('Medium'),
|
117 |
+
'large' => __('Large'),
|
118 |
+
'full' => __('Full Size'),
|
119 |
+
) );
|
120 |
+
$sizeLabels = apply_filters( 'image_size_names_choose', array() );
|
121 |
+
|
122 |
+
echo '<table class="widefat fixed" cellspacing="0">';
|
123 |
+
echo '<thead>
|
124 |
+
<tr>
|
125 |
+
<th>' . __('Size', 'microp') . '</th>
|
126 |
+
<th>' . __('Visible', 'microp') . '</th>
|
127 |
+
<th>' . __('Default JPEG Quality', 'microp') . '</th>
|
128 |
+
<th>' . __('Custom Label', 'microp') . '</th>
|
129 |
+
</tr>
|
130 |
+
</thead>
|
131 |
+
<tbody>';
|
132 |
+
|
133 |
+
$sizesSettings = unserialize($this->options['sizes_settings']);
|
134 |
+
|
135 |
+
foreach ($imageSizes as $s) {
|
136 |
+
$label = isset($sizeLabels[$s]) ? $sizeLabels[$s] : ucfirst( str_replace( '-', ' ', $s ) );
|
137 |
+
if (isset($_wp_additional_image_sizes[$s])) {
|
138 |
+
$cropMethod = $_wp_additional_image_sizes[$s]['crop'];
|
139 |
+
} else {
|
140 |
+
$cropMethod = get_option($s.'_crop');
|
141 |
+
}
|
142 |
+
|
143 |
+
if ($cropMethod == 0) {
|
144 |
+
continue;
|
145 |
+
}
|
146 |
+
|
147 |
+
echo '<tr>
|
148 |
+
<td>' . $label. '</td>
|
149 |
+
<td><select name="mic_options[sizes_settings][' . $s . '][visibility]">
|
150 |
+
<option value="visible">' . __('Yes', 'microp') . '</option>
|
151 |
+
<option value="hidden" ' . ( $sizesSettings[$s]['visibility'] == 'hidden' ? 'selected' : '' ) . '>' . __('No', 'microp') . '</option>
|
152 |
+
</select></td>
|
153 |
+
<td><select name="mic_options[sizes_settings][' . $s . '][quality]">
|
154 |
+
<option value="100">' . __('100 (best quality, biggest file)', 'microp') . '</option>
|
155 |
+
<option value="80" ' . ( !isset ($sizesSettings[$s]['quality']) || $sizesSettings[$s]['quality'] == '80' ? 'selected' : '' ) . '>' . __('80 (very high quality)', 'microp') . '</option>
|
156 |
+
<option value="70" ' . ( $sizesSettings[$s]['quality'] == '70' ? 'selected' : '' ) . '>' . __('70 (high quality)', 'microp') . '</option>
|
157 |
+
<option value="60" ' . ( $sizesSettings[$s]['quality'] == '60' ? 'selected' : '' ) . '>' . __('60 (good)', 'microp') . '</option>
|
158 |
+
<option value="50" ' . ( $sizesSettings[$s]['quality'] == '50' ? 'selected' : '' ) . '>' . __('50 (average)', 'microp') . '</option>
|
159 |
+
<option value="30" ' . ( $sizesSettings[$s]['quality'] == '30' ? 'selected' : '' ) . '>' . __('30 (low)', 'microp') . '</option>
|
160 |
+
<option value="10" ' . ( $sizesSettings[$s]['quality'] == '10' ? 'selected' : '' ) . '>' . __('10 (very low, smallest file)', 'microp') . '</option>
|
161 |
+
</select></td>
|
162 |
+
<td><input name="mic_options[sizes_settings][' . $s . '][label]" type="text" placeholder="' . $label . '" value="' . str_replace('"', '"', $sizesSettings[$s]['label']) . '"/></td>
|
163 |
+
</tr>';
|
164 |
+
}
|
165 |
+
echo '</tbody></table>';
|
166 |
+
|
167 |
+
}
|
168 |
+
}
|
169 |
+
|
170 |
+
if( is_admin() ) {
|
171 |
+
$mic_settings_page = new MicSettingsPage();
|
172 |
+
}
|
manual-image-crop.php
CHANGED
@@ -1,58 +1,62 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
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.
|
7 |
-
Author: Tomasz Sita
|
8 |
-
Author URI: http://www.rocketmill.co.uk/author/tomasz
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
include_once(dirname(__FILE__) . '/lib/ManualImageCrop.php');
|
16 |
-
include_once(dirname(__FILE__) . '/lib/ManualImageCropEditorWindow.php');
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
add_action('plugins_loaded', 'mic_init_plugin');
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
add_action('
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
58 |
;
|
1 |
+
<?php
|
2 |
+
/*
|
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.06
|
7 |
+
Author: Tomasz Sita
|
8 |
+
Author URI: http://www.rocketmill.co.uk/author/tomasz
|
9 |
+
License: GPL2
|
10 |
+
*/
|
11 |
+
|
12 |
+
define('mic_VERSION', '1.1');
|
13 |
+
|
14 |
+
|
15 |
+
include_once(dirname(__FILE__) . '/lib/ManualImageCrop.php');
|
16 |
+
include_once(dirname(__FILE__) . '/lib/ManualImageCropEditorWindow.php');
|
17 |
+
include_once(dirname(__FILE__) . '/lib/ManualImageCropSettingsPage.php');
|
18 |
+
|
19 |
+
//mic - stands for Manual Image Crop
|
20 |
+
|
21 |
+
add_action('plugins_loaded', 'mic_init_plugin');
|
22 |
+
|
23 |
+
add_option('mic_make2x', 'true'); //Add option so we can persist make2x choice across sessions
|
24 |
+
|
25 |
+
/**
|
26 |
+
* inits the plugin
|
27 |
+
*/
|
28 |
+
function mic_init_plugin() {
|
29 |
+
if (! is_admin()) {
|
30 |
+
//we are gonna use our plugin in the admin area only, so ends here if it's a frontend
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
load_plugin_textdomain('microp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
35 |
+
|
36 |
+
$ManualImageCrop = ManualImageCrop::getInstance();
|
37 |
+
add_action( 'admin_enqueue_scripts', array($ManualImageCrop, 'enqueueAssets') );
|
38 |
+
$ManualImageCrop->addEditorLinks();
|
39 |
+
|
40 |
+
//attach admin actions
|
41 |
+
add_action('wp_ajax_mic_editor_window', 'mic_ajax_editor_window');
|
42 |
+
add_action('wp_ajax_mic_crop_image', 'mic_ajax_crop_image');
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* ajax call rendering the image cropping area
|
47 |
+
*/
|
48 |
+
function mic_ajax_editor_window() {
|
49 |
+
$ManualImageCropEditorWindow = ManualImageCropEditorWindow::getInstance();
|
50 |
+
$ManualImageCropEditorWindow->renderWindow();
|
51 |
+
exit;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* ajax call that does the cropping job and overrides the previous image version
|
56 |
+
*/
|
57 |
+
function mic_ajax_crop_image() {
|
58 |
+
$ManualImageCrop = ManualImageCrop::getInstance();
|
59 |
+
$ManualImageCrop->cropImage();
|
60 |
+
exit;
|
61 |
+
}
|
62 |
;
|
readme.txt
CHANGED
@@ -1,58 +1,74 @@
|
|
1 |
-
=== Manual Image Crop ===
|
2 |
-
Contributors: tomasz.sita
|
3 |
-
Tags: crop, cropping, thumbnail, featured image, gallery, images, picture, image, image area
|
4 |
-
|
5 |
-
|
6 |
-
License: GPLv2 or later
|
7 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WB5ZQWGUM7T96
|
9 |
-
Stable tag: 1.
|
10 |
-
|
11 |
-
Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
|
12 |
-
|
13 |
-
|
14 |
-
== Description ==
|
15 |
-
Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
|
16 |
-
Simply click on the "Crop" link next to any image in your media library.
|
17 |
-
The "lightbox" style interface will be brought up and you are ready to go.
|
18 |
-
Whole cropping process is really intuitive and simple.
|
19 |
-
|
20 |
-
Apart from media library list, the plugin adds links in few more places:
|
21 |
-
* Below featured image box ("Crop featured image")
|
22 |
-
* In the media insert modal window (once you select an image)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
*
|
29 |
-
|
30 |
-
|
31 |
-
*
|
32 |
-
*
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
*
|
40 |
-
*
|
41 |
-
|
42 |
-
|
43 |
-
*
|
44 |
-
*
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
*
|
51 |
-
*
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
*
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
* Initial version
|
1 |
+
=== Manual Image Crop ===
|
2 |
+
Contributors: tomasz.sita
|
3 |
+
Tags: crop, cropping, thumbnail, featured image, gallery, images, picture, image, image area
|
4 |
+
Tested up to: 3.9.1
|
5 |
+
Requires at least: 3.0.1
|
6 |
+
License: GPLv2 or later
|
7 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WB5ZQWGUM7T96
|
9 |
+
Stable tag: 1.06
|
10 |
+
|
11 |
+
Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
|
12 |
+
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
Plugin allows you to manually crop all the image sizes registered in your WordPress theme (in particular featured image).
|
16 |
+
Simply click on the "Crop" link next to any image in your media library.
|
17 |
+
The "lightbox" style interface will be brought up and you are ready to go.
|
18 |
+
Whole cropping process is really intuitive and simple.
|
19 |
+
|
20 |
+
Apart from media library list, the plugin adds links in few more places:
|
21 |
+
* Below featured image box ("Crop featured image")
|
22 |
+
* In the media insert modal window (once you select an image)
|
23 |
+
|
24 |
+
GitHub Repository:
|
25 |
+
https://github.com/tomaszsita/wp-manual-image-crop
|
26 |
+
|
27 |
+
Translations:
|
28 |
+
* French (Gabriel Féron)
|
29 |
+
* German (Bertram Greenhough)
|
30 |
+
* Italian (htrex)
|
31 |
+
* Polish (myself)
|
32 |
+
* Spanish (Andrew Kurtis)
|
33 |
+
|
34 |
+
Please contact me if you want to add a translation (or submit a pull request on GitHub)
|
35 |
+
|
36 |
+
|
37 |
+
== Installation ==
|
38 |
+
Manually:
|
39 |
+
* Upload `manual-image-crop` to the `/wp-content/plugins/` directory
|
40 |
+
* Activate the plugin through the 'Plugins' menu in WordPress
|
41 |
+
|
42 |
+
Automatically:
|
43 |
+
* Navigate to the 'Plugins' menu inside of the wordpress wp-admin dashboard, and select AD NEW
|
44 |
+
* Search for 'Manual Imag Crop', and click install
|
45 |
+
* When the plugin has been installed, Click 'Activate'
|
46 |
+
|
47 |
+
== Changelog ==
|
48 |
+
= 1.06 =
|
49 |
+
* French, German, Italian, Polish, Spanish translations added
|
50 |
+
* Settings page added (quality, visibility, custom labels)
|
51 |
+
* Compatibility with Retina/HiDPI (@2x) plugin added
|
52 |
+
* Fixed issue with closing editor window from within media uploader screen
|
53 |
+
|
54 |
+
= 1.05 =
|
55 |
+
* WordPress 3.9 compatibility issues fixed
|
56 |
+
* Removed randomly floated 'Maximum upload file size'
|
57 |
+
|
58 |
+
= 1.04 =
|
59 |
+
* Added remembering of the previously selected area after cropping the specific image size
|
60 |
+
* Fixed the "wp_enqueue_script was called incorrectly" warning in the WP debug mode
|
61 |
+
|
62 |
+
= 1.03 =
|
63 |
+
* Fixed the issue with overwriting the original image when cropping image size registered after the attachment had been uploaded
|
64 |
+
|
65 |
+
= 1.02 =
|
66 |
+
* Fixed HTTP Authentication no preview issue
|
67 |
+
* Fixed path issues on multisite/subfolder WP installations
|
68 |
+
|
69 |
+
= 1.01 =
|
70 |
+
* Fixed Chrome stretched image issue
|
71 |
+
* Improved compatibility with other plugins using 'thickbox'
|
72 |
+
|
73 |
+
= 1.0 =
|
74 |
* Initial version
|