Skip to content

Commit

Permalink
- Disabled crop button if width or height of source is lower or equal…
Browse files Browse the repository at this point in the history
… than cropping size

- Formatting
  • Loading branch information
akarmosin committed Sep 30, 2022
1 parent 544a804 commit 78a1f94
Show file tree
Hide file tree
Showing 10 changed files with 1,052 additions and 838 deletions.
160 changes: 79 additions & 81 deletions __dev/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions __dev/src/components/cropeditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@
</div>
<div class="ratio">{{ lang.ratio }} {{ cropData.sourceImage.full.printRatio }}</div>
</div>

<button type="button" class="button cptGenerate" :class="{'button-primary':croppingApi}"
@click="cropThumbnails()" :disabled="!croppingApi">{{ lang.label_crop }}
@click="cropThumbnails()" :disabled="isCropButtonDisabled()">{{ lang.label_crop }}
</button>

<div class="cropContainer">
Expand Down Expand Up @@ -316,7 +317,7 @@ export default {
}
return false;
}
if (this.currentCropSize.width < image.width || this.currentCropSize.height < image.height) {
if (this.currentCropSize.width <= image.width || this.currentCropSize.height <= image.height) {
return true;
}
return false;
Expand Down Expand Up @@ -439,6 +440,17 @@ export default {
this.showDebugType = type;
}
},
isCropButtonDisabled() {
let isLowRes = false;
this.selectedImageSizes.forEach(imageSize => {
if (this.isLowRes(imageSize)) {
isLowRes = true;
}
});
return this.croppingApi === null || isLowRes;
},
cropThumbnails() {
let that = this;
Expand Down
2 changes: 1 addition & 1 deletion app/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/js/app.js.map

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions crop-thumbnails.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
* Author URI: https://www.totalmedial.de
* Version: 1.5.0
* Description: The easy way to adjust your cropped image sizes.
*
*
*
*
* License: GPL v3
* Copyright 2012 Volkmar Kantor (email : [email protected])
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Expand All @@ -26,10 +24,10 @@
*/


define('CROP_THUMBNAILS_VERSION','1.5.0');
define( 'CROP_THUMBNAILS_VERSION', '1.5.0' );

include_once __DIR__.'/functions/helper.php';
include_once __DIR__.'/functions/settingsscreen.php';
include_once __DIR__.'/functions/editor.php';
include_once __DIR__.'/functions/backendpreparer.php';
include_once __DIR__.'/functions/save.php';
include_once __DIR__ . '/functions/helper.php';
include_once __DIR__ . '/functions/settingsscreen.php';
include_once __DIR__ . '/functions/editor.php';
include_once __DIR__ . '/functions/backendpreparer.php';
include_once __DIR__ . '/functions/save.php';
Loading

0 comments on commit 78a1f94

Please sign in to comment.