Файловый менеджер - Редактировать - /home/harasnat/www/labour/wp-content/plugins/events-manager/includes/external/filepond/plugins/filepond-plugin-image-exif-orientation.min.js
Назад
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):(global=global||self,global.FilePondPluginImageExifOrientation=factory())})(this,function(){"use strict";var isJPEG=function isJPEG(file){return/^image\/jpeg/.test(file.type)};var Marker={JPEG:65496,APP1:65505,EXIF:1165519206,TIFF:18761,Orientation:274,Unknown:65280};var getUint16=function getUint16(view,offset){var little=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return view.getUint16(offset,little)};var getUint32=function getUint32(view,offset){var little=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return view.getUint32(offset,little)};var getImageOrientation=function getImageOrientation(file){return new Promise(function(resolve,reject){var reader=new FileReader;reader.onload=function(e){var view=new DataView(e.target.result);if(getUint16(view,0)!==Marker.JPEG){resolve(-1);return}var length=view.byteLength;var offset=2;while(offset<length){var marker=getUint16(view,offset);offset+=2;if(marker===Marker.APP1){if(getUint32(view,offset+=2)!==Marker.EXIF){break}var little=getUint16(view,offset+=6)===Marker.TIFF;offset+=getUint32(view,offset+4,little);var tags=getUint16(view,offset,little);offset+=2;for(var i=0;i<tags;i++){if(getUint16(view,offset+i*12,little)===Marker.Orientation){resolve(getUint16(view,offset+i*12+8,little));return}}}else if((marker&Marker.Unknown)!==Marker.Unknown){break}else{offset+=getUint16(view,offset)}}resolve(-1)};reader.readAsArrayBuffer(file.slice(0,64*1024))})};var IS_BROWSER=function(){return typeof window!=="undefined"&&typeof window.document!=="undefined"}();var isBrowser=function isBrowser(){return IS_BROWSER};var testSrc="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";var shouldCorrect=undefined;var testImage=isBrowser()?new Image:{};testImage.onload=function(){return shouldCorrect=testImage.naturalWidth>testImage.naturalHeight};testImage.src=testSrc;var shouldCorrectImageExifOrientation=function shouldCorrectImageExifOrientation(){return shouldCorrect};var plugin=function plugin(_ref){var addFilter=_ref.addFilter,utils=_ref.utils;var Type=utils.Type,isFile=utils.isFile;addFilter("DID_LOAD_ITEM",function(item,_ref2){var query=_ref2.query;return new Promise(function(resolve,reject){var file=item.file;if(!isFile(file)||!isJPEG(file)||!query("GET_ALLOW_IMAGE_EXIF_ORIENTATION")||!shouldCorrectImageExifOrientation()){return resolve(item)}getImageOrientation(file).then(function(orientation){item.setMetadata("exif",{orientation:orientation});resolve(item)})})});return{options:{allowImageExifOrientation:[true,Type.BOOLEAN]}}};var isBrowser$1=typeof window!=="undefined"&&typeof window.document!=="undefined";if(isBrowser$1){document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:plugin}))}return plugin});
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка