Skip to content

Commit

Permalink
Issue #40. read exif orientation information
Browse files Browse the repository at this point in the history
  • Loading branch information
cstefanache committed Aug 22, 2016
1 parent 992b5a7 commit c2105a2
Show file tree
Hide file tree
Showing 11 changed files with 1,647 additions and 26 deletions.
7 changes: 3 additions & 4 deletions src/ImageCropper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class ImageCropper extends ImageCropperModel {
}

static detectVerticalSquash(img) {
var iw = img.naturalWidth, ih = img.naturalHeight;
var ih = img.height;
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = ih;
Expand Down Expand Up @@ -609,12 +609,12 @@ export class ImageCropper extends ImageCropperModel {
return this.imageSet;
}

setImage(img) {
setImage(img:any) {
if (!img) {
throw "Image is null";
}


this.srcImage = img;
this.imageSet = true;
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
var bufferContext = this.buffer.getContext('2d');
Expand All @@ -629,7 +629,6 @@ export class ImageCropper extends ImageCropperModel {
//TODO: investigate better solution
//this.fileType = img.src.match(/^data:.+\/(.+);base64,(.*)$/)[1];

this.srcImage = img;

if (this.cropperSettings.minWithRelativeToResolution) {
this.minWidth = (this.canvas.width * this.minWidth / this.srcImage.width);
Expand Down
25 changes: 25 additions & 0 deletions src/exif.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export declare class Exif {
static debug: boolean;
static IptcFieldMap: Object;
static Tags: Object;
static TiffTags: Object;
static GPSTags: Object;
static StringValues: Object;
static addEvent(element: any, event: any, handler: any): void;
static imageHasData(img: any): boolean;
static base64ToArrayBuffer(base64: any, contentType?: any): ArrayBuffer;
static objectURLToBlob(url: any, callback: any): void;
static getImageData(img: any, callback: any): void;
static findEXIFinJPEG(file: any): any;
static findIPTCinJPEG(file: any): {};
static readIPTCData(file: any, startOffset: any, sectionLength: any): {};
static readTags(file: any, tiffStart: any, dirStart: any, strings: any, bigEnd: any): {};
static readTagValue(file: any, entryOffset: any, tiffStart: any, dirStart: any, bigEnd: any): any;
static getStringFromDB(buffer: any, start: any, length: any): string;
static readEXIFData(file: any, start: any): any;
static getData(img: any, callback: Function): boolean;
static getTag(img: any, tag: any): any;
static getAllTags(img: any): {};
static pretty(img: any): string;
readFromBinaryFile(file: any): any;
}
Loading

0 comments on commit c2105a2

Please # to comment.