-
-
Save jaketoolson/f70fb7e1ad47342b1c2226ad119ff6ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//parse meta data | |
loadImage.parseMetaData(blobOrFile, function(data) { | |
//default image orientation | |
var orientation = 0; | |
//if exif data available, update orientation | |
if (data.exif) { | |
orientation = data.exif.get('Orientation'); | |
} | |
var loadingImage = loadImage( | |
blobOrFile, | |
function(canvas) { | |
//here's the base64 data result | |
var base64data = canvas.toDataURL('image/jpeg'); | |
//here's example to show it as on imae preview | |
var img_src = base64data.replace(/^data\:image\/\w+\;base64\,/, ''); | |
$('#result-preview').attr('src', base64data); | |
}, { | |
//should be set to canvas : true to activate auto fix orientation | |
canvas: true, | |
orientation: orientation | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment