Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

fixed min-/max- width & height conditions #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ $('.dropify').dropify();
```


* __minHeight:__ Set the min height allowed. An error will be display if the width is smaller than the option.
* __minHeight:__ Set the min height allowed. An error will be display if the height is smaller than the option.

```html
<input type="file" class="dropify" data-min-height="400" />
```


* __maxHeight:__ Set the max height allowed. An error will be display if the width is bigger than the option.
* __maxHeight:__ Set the max height allowed. An error will be display if the height is bigger than the option.

```html
<input type="file" class="dropify" data-max-height="1000" />
Expand Down
8 changes: 4 additions & 4 deletions dist/js/dropify.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,19 @@ Dropify.prototype.sizeToByte = function(size)
*/
Dropify.prototype.validateImage = function()
{
if (this.settings.minWidth !== 0 && this.settings.minWidth >= this.file.width) {
if (this.settings.minWidth !== 0 && this.settings.minWidth > this.file.width) {
this.pushError("minWidth");
}

if (this.settings.maxWidth !== 0 && this.settings.maxWidth <= this.file.width) {
if (this.settings.maxWidth !== 0 && this.settings.maxWidth < this.file.width) {
this.pushError("maxWidth");
}

if (this.settings.minHeight !== 0 && this.settings.minHeight >= this.file.height) {
if (this.settings.minHeight !== 0 && this.settings.minHeight > this.file.height) {
this.pushError("minHeight");
}

if (this.settings.maxHeight !== 0 && this.settings.maxHeight <= this.file.height) {
if (this.settings.maxHeight !== 0 && this.settings.maxHeight < this.file.height) {
this.pushError("maxHeight");
}

Expand Down
Loading