Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

Commit

Permalink
Fixed #26 #27 如果原图小于设定的宽高,那么按原尺寸处理,感谢 @yuu2lee4 @Messilimeng
Browse files Browse the repository at this point in the history
  • Loading branch information
think2011 committed Oct 17, 2015
1 parent 6c512bf commit b078990
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lrz",
"version": "4.2.6",
"version": "4.2.10",
"homepage": "https://github.com/think2011/localResizeIMG4",
"authors": [
"think2011 <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion dist/lrz.all.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lrz.all.bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lrz.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/lrz.bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lrz",
"version": "4.2.6",
"version": "4.2.10",
"description": "前端本地客户端压缩图片,兼容IOS,Android,PC、自动按需加载文件",
"scripts": {
"test": "node ./node_modules/karma/bin/karma start"
Expand Down
8 changes: 8 additions & 0 deletions src/lrz.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ Lrz.prototype._getResize = function () {
if (orientation && ("5678".indexOf(orientation) > -1)) {
ret.width = img.height;
ret.height = img.width;

width = defaults.height;
height = defaults.width;
}

// 如果原图小于设定,采用原图
if (ret.width < width || ret.height < height) {
return ret;
}

var scale = ret.width / ret.height;
Expand Down
4 changes: 2 additions & 2 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ <h3>旋转方向测试</h3>
</footer>


<script src="../dist/lrz.bundle.js?v=90e352d"></script>
<script src="./index.js?v=7606e85"></script>
<script src="../dist/lrz.bundle.js?v=c2db08d"></script>
<script src="./index.js?v=16b90b1"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ String.prototype.render = function (obj) {
};

/**
* 触发事件
* 触发事件 - 只是为了兼容演示demo而已
* @param element
* @param event
* @returns {boolean}
Expand Down

0 comments on commit b078990

Please sign in to comment.