blueimp / JavaScript-Load-Image

Load images provided as File or Blob objects or via URL. Retrieve an optionally scaled, cropped or rotated HTML img or canvas element. Use methods to parse image metadata to extract IPTC and Exif tags as well as embedded thumbnail images, to overwrite the Exif Orientation value and to restore the complete image header after resizing.
https://blueimp.github.io/JavaScript-Load-Image/
MIT License
4.45k stars 924 forks source link

browserify support #59

Closed hugomrdias closed 9 years ago

hugomrdias commented 10 years ago

In a browserify package, this will refer to a node-style exports object, not window. So just reference window directly.

OtaK commented 9 years ago

Why would you want to browserify it? It doesn't depend on any AMD or node/npm modules.

Something like this should be enough to support requireJS/commonJS or any AMD loader:


// AMD / CommonJS stuff
if (typeof define === 'function' && !!define.amd)
    define(function() { return loadImage; });
else if (typeof module === 'object' && !!module && typeof module.exports === 'object' && !!module.exports)
    module.exports = loadImage;
else
    window.loadImage = loadImage;
blueimp commented 9 years ago

Sorry for my late reply. If this package is loaded via browserify, it's intended that loadImage should be set as a property of the exports object.

D34THWINGS commented 9 years ago

@blueimp can you make the same changes that you made on this PR https://github.com/blueimp/JavaScript-Canvas-to-Blob/pull/22 ? Because your library is unusable alongside browserify otherwise

blueimp commented 9 years ago

@D34THWINGS: Done.

@hugomrdias: Sorry for the delay of one year, I think this pull request was closed by mistake back then.

D34THWINGS commented 9 years ago

Thanks !