You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.7 KiB
33 lines
1.7 KiB
7 years ago
|
// EXIF Orientation test
|
||
|
|
||
|
// iOS looks at the EXIF Orientation flag in jpgs and rotates the image
|
||
|
// accordingly. Looks like most desktop browsers just ignore this data.
|
||
|
|
||
|
// description: www.impulseadventure.com/photo/exif-orientation.html
|
||
|
|
||
|
// Bug trackers:
|
||
|
// bugzil.la/298619 (unimplemented)
|
||
|
// crbug.com/56845 (looks incomplete)
|
||
|
// webk.it/19688 (available upstream but its up all ports to turn on individually)
|
||
|
//
|
||
|
|
||
|
// detect by Paul Sayre
|
||
|
|
||
|
|
||
|
(function(){
|
||
|
|
||
|
var img = new Image();
|
||
|
|
||
|
img.onerror = function() {
|
||
|
Modernizr.addTest('exif-orientation', function () { return false; });
|
||
|
};
|
||
|
|
||
|
img.onload = function() {
|
||
|
Modernizr.addTest('exif-orientation', function () { return img.width !== 2; });
|
||
|
};
|
||
|
|
||
|
// There may be a way to shrink this more, it's a 1x2 white jpg with the orientation flag set to 6
|
||
|
img.src = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAASUkqAAgAAAABABIBAwABAAAABgASAAAAAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAABAAIDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD+/iiiigD/2Q==";
|
||
|
|
||
|
})();
|