Skip to content

Commit 913f426

Browse files
committed
new transformations added, test coverage improved
1 parent 1b3bf24 commit 913f426

File tree

3 files changed

+541
-12
lines changed

3 files changed

+541
-12
lines changed

constants/supportedTransforms.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ module.exports = {
22
"height": "h",
33
"width": "w",
44
"aspectRatio": "ar",
5+
"padResizeCrop": "cm-pad_resize",
6+
"forcedCrop": "c-force",
7+
"maxSizeCrop": "c-at_max",
8+
"minSizeCrop": "c-at_least",
9+
"maintainRatioCrop": "c-maintain_ratio",
10+
"extractCrop": "cm-extract",
11+
"padExtractCrop": "cm-pad_extract",
12+
"autoSmartCrop": "fo-auto",
13+
"faceCrop": "fo-face",
14+
"focusCustom": "fo-custom",
15+
"xc": "xc",
16+
"yc": "yc",
517
"quality": "q",
618
"crop": "c",
719
"cropMode": "cm",
@@ -13,7 +25,6 @@ module.exports = {
1325
"background": "bg",
1426
"border": "b",
1527
"rotation": "rt",
16-
"rotate": "rt",
1728
"blur": "bl",
1829
"named": "n",
1930
"overlayImage": "oi",
@@ -43,6 +54,21 @@ module.exports = {
4354
"overlayTextPadding": "otp",
4455
"overlayTextInnerAlignment": "otia",
4556
"overlayRadius": "or",
57+
"overlayMinSizeCrop": "oic-at_least",
58+
"overlayMaxSizeCrop": "oic-at_max",
59+
"overlayForcedCrop": "oic-force",
60+
"overlayMaintainRatioCrop": "oic-maintain_ratio",
61+
"overlayExtractCrop": "oicm-extract",
62+
"overlayPadExtractCrop": "oicm-pad_extract",
63+
"overlayPadResizeCrop": "oicm-pad_resize",
64+
"overlayFocusCrop": "oifo",
65+
"overlayAutoSmartCrop": "oifo-auto",
66+
"overlayFocusCustom": "oifo-custom",
67+
"overlayFaceCrop": "oifo-face",
68+
"oixc": "oixc",
69+
"oiyc": "oiyc",
70+
"oix": "oix",
71+
"oiy": "oiy",
4672
"progressive": "pr",
4773
"lossless": "lo",
4874
"trim": "t",

libs/manage/file.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ module.exports.bulkRemoveTags = function(fileIdArray, tags, defaultOptions, call
202202
*/
203203
module.exports.copyFile = function(sourceFilePath, destinationPath, defaultOptions, callback) {
204204

205-
if(sourceFilePath.length === 0 || typeof(sourceFilePath) !== 'string'
206-
|| destinationPath.length === 0 || typeof(destinationPath) !== 'string') {
205+
if(typeof(destinationPath) !== 'string' || typeof(sourceFilePath) !== 'string'
206+
|| destinationPath.length === 0 || sourceFilePath.length === 0) {
207207
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
208208
return;
209209
}
@@ -227,8 +227,8 @@ module.exports.copyFile = function(sourceFilePath, destinationPath, defaultOptio
227227
*/
228228
module.exports.moveFile = function(sourceFilePath, destinationPath, defaultOptions, callback) {
229229

230-
if(sourceFilePath.length === 0 || typeof(sourceFilePath) !== 'string'
231-
|| destinationPath.length === 0 || typeof(destinationPath) !== 'string') {
230+
if(typeof(destinationPath) !== 'string' || typeof(sourceFilePath) !== 'string'
231+
|| destinationPath.length === 0 || sourceFilePath.length === 0) {
232232
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
233233
return;
234234
}
@@ -252,8 +252,8 @@ module.exports.moveFile = function(sourceFilePath, destinationPath, defaultOptio
252252
*/
253253
module.exports.copyFolder = function(sourceFolderPath, destinationPath, defaultOptions, callback) {
254254

255-
if(sourceFolderPath.length === 0 || typeof(sourceFolderPath) !== 'string'
256-
|| destinationPath.length === 0 || typeof(destinationPath) !== 'string') {
255+
if(typeof(destinationPath) !== 'string' || typeof(sourceFolderPath) !== 'string'
256+
|| destinationPath.length === 0 || sourceFolderPath.length === 0) {
257257
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
258258
return;
259259
}
@@ -277,8 +277,8 @@ module.exports.copyFolder = function(sourceFolderPath, destinationPath, defaultO
277277
*/
278278
module.exports.moveFolder = function(sourceFolderPath, destinationPath, defaultOptions, callback) {
279279

280-
if(sourceFolderPath.length === 0 || typeof(sourceFolderPath) !== 'string'
281-
|| destinationPath.length === 0 || typeof(destinationPath) !== 'string') {
280+
if(typeof(destinationPath) !== 'string' || typeof(sourceFolderPath) !== 'string'
281+
|| destinationPath.length === 0 || sourceFolderPath.length === 0) {
282282
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
283283
return;
284284
}
@@ -302,12 +302,12 @@ module.exports.moveFolder = function(sourceFolderPath, destinationPath, defaultO
302302
*/
303303
module.exports.createFolder = function(folderName, parentFolderPath, defaultOptions, callback) {
304304

305-
if(folderName.length === 0 || typeof(folderName) !== 'string') {
305+
if(typeof(folderName) !== 'string' || folderName.length === 0) {
306306
respond(true, errorMessages.INVALID_FOLDER_NAME, callback);
307307
return;
308308
}
309309

310-
if(parentFolderPath.length === 0 || typeof(parentFolderPath) !== 'string') {
310+
if(typeof(parentFolderPath) !== 'string' || parentFolderPath.length === 0) {
311311
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
312312
return;
313313
}
@@ -331,7 +331,7 @@ module.exports.createFolder = function(folderName, parentFolderPath, defaultOpti
331331
*/
332332
module.exports.deleteFolder = function(folderPath, defaultOptions, callback) {
333333

334-
if(folderPath.length === 0 || typeof(folderPath) !== 'string') {
334+
if(typeof(folderPath) !== 'string' || folderPath.length === 0) {
335335
respond(true, errorMessages.INVALID_DIRECTORY_PATH, callback);
336336
return;
337337
}

0 commit comments

Comments
 (0)