Skip to content

Commit

Permalink
build: release 1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuanchen committed Oct 24, 2018
1 parent 3bb44c7 commit ed45be1
Show file tree
Hide file tree
Showing 12 changed files with 397 additions and 650 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## next
## 1.4.3 (Oct 24, 2018)

- Ignore range error when the image does not have correct Exif information

Expand Down
101 changes: 53 additions & 48 deletions dist/cropper.common.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.4.2
* Cropper.js v1.4.3
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-10-15T13:27:01.969Z
* Date: 2018-10-24T13:07:15.032Z
*/

'use strict';
Expand Down Expand Up @@ -995,69 +995,74 @@ function arrayBufferToDataURL(arrayBuffer, mimeType) {

function resetAndGetOrientation(arrayBuffer) {
var dataView = new DataView(arrayBuffer);
var orientation;
var littleEndian;
var app1Start;
var ifdStart; // Only handle JPEG image (start by 0xFFD8)

if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
var length = dataView.byteLength;
var offset = 2;

while (offset < length) {
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
app1Start = offset;
break;
}
var orientation; // Ignores range error when the image does not have correct Exif information

try {
var littleEndian;
var app1Start;
var ifdStart; // Only handle JPEG image (start by 0xFFD8)

if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
var length = dataView.byteLength;
var offset = 2;

offset += 1;
while (offset + 1 < length) {
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
app1Start = offset;
break;
}

offset += 1;
}
}
}

if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;
if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;

if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 0x4949;
if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 0x4949;

if (littleEndian || endianness === 0x4D4D
/* bigEndian */
) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
if (littleEndian || endianness === 0x4D4D
/* bigEndian */
) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);

if (firstIFDOffset >= 0x00000008) {
ifdStart = tiffOffset + firstIFDOffset;
if (firstIFDOffset >= 0x00000008) {
ifdStart = tiffOffset + firstIFDOffset;
}
}
}
}
}
}
}

if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);
if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);

var _offset;
var _offset;

var i;
var i;

for (i = 0; i < _length; i += 1) {
_offset = ifdStart + i * 12 + 2;
for (i = 0; i < _length; i += 1) {
_offset = ifdStart + i * 12 + 2;

if (dataView.getUint16(_offset, littleEndian) === 0x0112
/* Orientation */
) {
// 8 is the offset of the current tag's value
_offset += 8; // Get the original orientation value
if (dataView.getUint16(_offset, littleEndian) === 0x0112
/* Orientation */
) {
// 8 is the offset of the current tag's value
_offset += 8; // Get the original orientation value

orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value
orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value

dataView.setUint16(_offset, 1, littleEndian);
break;
}
dataView.setUint16(_offset, 1, littleEndian);
break;
}
}
}
} catch (e) {
orientation = 1;
}

return orientation;
Expand Down
4 changes: 2 additions & 2 deletions dist/cropper.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.4.2
* Cropper.js v1.4.3
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-10-15T13:26:58.111Z
* Date: 2018-10-24T13:07:11.429Z
*/

.cropper-container {
Expand Down
101 changes: 53 additions & 48 deletions dist/cropper.esm.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* Cropper.js v1.4.2
* Cropper.js v1.4.3
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2018-10-15T13:27:01.969Z
* Date: 2018-10-24T13:07:15.032Z
*/

function _typeof(obj) {
Expand Down Expand Up @@ -993,69 +993,74 @@ function arrayBufferToDataURL(arrayBuffer, mimeType) {

function resetAndGetOrientation(arrayBuffer) {
var dataView = new DataView(arrayBuffer);
var orientation;
var littleEndian;
var app1Start;
var ifdStart; // Only handle JPEG image (start by 0xFFD8)

if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
var length = dataView.byteLength;
var offset = 2;

while (offset < length) {
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
app1Start = offset;
break;
}
var orientation; // Ignores range error when the image does not have correct Exif information

try {
var littleEndian;
var app1Start;
var ifdStart; // Only handle JPEG image (start by 0xFFD8)

if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
var length = dataView.byteLength;
var offset = 2;

offset += 1;
while (offset + 1 < length) {
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
app1Start = offset;
break;
}

offset += 1;
}
}
}

if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;
if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;

if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 0x4949;
if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 0x4949;

if (littleEndian || endianness === 0x4D4D
/* bigEndian */
) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
if (littleEndian || endianness === 0x4D4D
/* bigEndian */
) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);

if (firstIFDOffset >= 0x00000008) {
ifdStart = tiffOffset + firstIFDOffset;
if (firstIFDOffset >= 0x00000008) {
ifdStart = tiffOffset + firstIFDOffset;
}
}
}
}
}
}
}

if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);
if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);

var _offset;
var _offset;

var i;
var i;

for (i = 0; i < _length; i += 1) {
_offset = ifdStart + i * 12 + 2;
for (i = 0; i < _length; i += 1) {
_offset = ifdStart + i * 12 + 2;

if (dataView.getUint16(_offset, littleEndian) === 0x0112
/* Orientation */
) {
// 8 is the offset of the current tag's value
_offset += 8; // Get the original orientation value
if (dataView.getUint16(_offset, littleEndian) === 0x0112
/* Orientation */
) {
// 8 is the offset of the current tag's value
_offset += 8; // Get the original orientation value

orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value
orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value

dataView.setUint16(_offset, 1, littleEndian);
break;
}
dataView.setUint16(_offset, 1, littleEndian);
break;
}
}
}
} catch (e) {
orientation = 1;
}

return orientation;
Expand Down
Loading

0 comments on commit ed45be1

Please sign in to comment.