@react-pdf/image
Advanced tools
Comparing version 2.3.0 to 2.3.1
@@ -5,2 +5,3 @@ import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime'; | ||
import PNG from '@react-pdf/png-js'; | ||
import exif from 'jpeg-exif'; | ||
@@ -1987,4 +1988,2 @@ var global$1 = (typeof global !== "undefined" ? global : | ||
// Extracted from https://github.com/devongovett/pdfkit/blob/master/lib/image/jpeg.coffee | ||
var MARKERS = [0xffc0, 0xffc1, 0xffc2, 0xffc3, 0xffc5, 0xffc6, 0xffc7, 0xffc8, 0xffc9, 0xffca, 0xffcb, 0xffcc, 0xffcd, 0xffce, 0xffcf]; | ||
@@ -2001,2 +2000,5 @@ var JPEG = function JPEG(data) { | ||
var pos = 2; | ||
// Parse the EXIF orientation | ||
this.orientation = exif.fromBuffer(this.data).Orientation || 1; | ||
while (pos < data.length) { | ||
@@ -2017,2 +2019,7 @@ marker = data.readUInt16BE(pos); | ||
this.width = data.readUInt16BE(pos); | ||
if (this.orientation > 4) { | ||
var _ref = [this.height, this.width]; | ||
this.width = _ref[0]; | ||
this.height = _ref[1]; | ||
} | ||
}; | ||
@@ -2019,0 +2026,0 @@ JPEG.isValid = function (data) { |
@@ -8,2 +8,3 @@ import _regeneratorRuntime from '@babel/runtime/helpers/regeneratorRuntime'; | ||
import PNG from '@react-pdf/png-js'; | ||
import exif from 'jpeg-exif'; | ||
@@ -18,4 +19,2 @@ PNG.isValid = function isValid(data) { | ||
// Extracted from https://github.com/devongovett/pdfkit/blob/master/lib/image/jpeg.coffee | ||
var MARKERS = [0xffc0, 0xffc1, 0xffc2, 0xffc3, 0xffc5, 0xffc6, 0xffc7, 0xffc8, 0xffc9, 0xffca, 0xffcb, 0xffcc, 0xffcd, 0xffce, 0xffcf]; | ||
@@ -32,2 +31,5 @@ var JPEG = function JPEG(data) { | ||
var pos = 2; | ||
// Parse the EXIF orientation | ||
this.orientation = exif.fromBuffer(this.data).Orientation || 1; | ||
while (pos < data.length) { | ||
@@ -48,2 +50,7 @@ marker = data.readUInt16BE(pos); | ||
this.width = data.readUInt16BE(pos); | ||
if (this.orientation > 4) { | ||
var _ref = [this.height, this.width]; | ||
this.width = _ref[0]; | ||
this.height = _ref[1]; | ||
} | ||
}; | ||
@@ -50,0 +57,0 @@ JPEG.isValid = function (data) { |
{ | ||
"name": "@react-pdf/image", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"license": "MIT", | ||
@@ -35,3 +35,4 @@ "description": "Parses the images in png or jpeg format for react-pdf document", | ||
"@react-pdf/png-js": "^2.3.0", | ||
"cross-fetch": "^3.1.5" | ||
"cross-fetch": "^3.1.5", | ||
"jpeg-exif": "^1.1.4" | ||
}, | ||
@@ -38,0 +39,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
144239
4475
4
4
+ Addedjpeg-exif@^1.1.4
+ Addedjpeg-exif@1.1.4(transitive)