jquery-file-upload-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +20 -0
  3. data/README.md +55 -0
  4. data/Rakefile +32 -0
  5. data/app/views/jquery_file_upload/basic_plus_ui/_download.html.erb +43 -0
  6. data/app/views/jquery_file_upload/basic_plus_ui/_form.html.haml +35 -0
  7. data/app/views/jquery_file_upload/basic_plus_ui/_upload.html.erb +32 -0
  8. data/config/locales/jquery_file_upload.cs.yml +16 -0
  9. data/config/locales/jquery_file_upload.en.yml +16 -0
  10. data/lib/jquery-file-upload-rails.rb +1 -0
  11. data/lib/jquery_file_upload/rails.rb +6 -0
  12. data/lib/jquery_file_upload/rails/version.rb +5 -0
  13. data/test/dummy/README.rdoc +28 -0
  14. data/test/dummy/app/assets/javascripts/application.js +13 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/controllers/application_controller.rb +5 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/test/dummy/bin/bundle +3 -0
  20. data/test/dummy/bin/rails +4 -0
  21. data/test/dummy/bin/rake +4 -0
  22. data/test/dummy/config.ru +4 -0
  23. data/test/dummy/config/application.rb +22 -0
  24. data/test/dummy/config/boot.rb +5 -0
  25. data/test/dummy/config/database.yml +25 -0
  26. data/test/dummy/config/environment.rb +5 -0
  27. data/test/dummy/config/environments/development.rb +29 -0
  28. data/test/dummy/config/environments/production.rb +80 -0
  29. data/test/dummy/config/environments/test.rb +36 -0
  30. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  32. data/test/dummy/config/initializers/inflections.rb +16 -0
  33. data/test/dummy/config/initializers/mime_types.rb +5 -0
  34. data/test/dummy/config/initializers/secret_token.rb +12 -0
  35. data/test/dummy/config/initializers/session_store.rb +3 -0
  36. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  37. data/test/dummy/config/locales/en.yml +23 -0
  38. data/test/dummy/config/routes.rb +56 -0
  39. data/test/dummy/db/test.sqlite3 +0 -0
  40. data/test/jquery_file_upload_rails_test.rb +7 -0
  41. data/test/test_helper.rb +15 -0
  42. data/vendor/assets/images/jquery-file-upload/loading.gif +0 -0
  43. data/vendor/assets/images/jquery-file-upload/progressbar.gif +0 -0
  44. data/vendor/assets/javascripts/jquery-file-upload/app.js +101 -0
  45. data/vendor/assets/javascripts/jquery-file-upload/basic-plus-ui-no-widget.js.coffee +35 -0
  46. data/vendor/assets/javascripts/jquery-file-upload/basic-plus-ui.js.coffee +38 -0
  47. data/vendor/assets/javascripts/jquery-file-upload/cors/jquery.postmessage-transport.js +118 -0
  48. data/vendor/assets/javascripts/jquery-file-upload/cors/jquery.xdr-transport.js +87 -0
  49. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-angular.js +428 -0
  50. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-audio.js +106 -0
  51. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-image.js +295 -0
  52. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-jquery-ui.js +144 -0
  53. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-process.js +172 -0
  54. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-ui.js +699 -0
  55. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-validate.js +120 -0
  56. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload-video.js +106 -0
  57. data/vendor/assets/javascripts/jquery-file-upload/jquery.fileupload.js +1416 -0
  58. data/vendor/assets/javascripts/jquery-file-upload/jquery.iframe-transport.js +210 -0
  59. data/vendor/assets/javascripts/jquery-file-upload/main.js.coffee +4 -0
  60. data/vendor/assets/javascripts/jquery-file-upload/vendor/canvas-to-blob/canvas-to-blob.js +95 -0
  61. data/vendor/assets/javascripts/jquery-file-upload/vendor/canvas-to-blob/canvas-to-blob.min.js +1 -0
  62. data/vendor/assets/javascripts/jquery-file-upload/vendor/jquery.ui.widget.js +530 -0
  63. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/demo.js +138 -0
  64. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image-exif-map.js +384 -0
  65. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image-exif.js +299 -0
  66. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image-ios.js +181 -0
  67. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image-meta.js +137 -0
  68. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image-orientation.js +159 -0
  69. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image.js +276 -0
  70. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/load-image.min.js +1 -0
  71. data/vendor/assets/javascripts/jquery-file-upload/vendor/load-image/vendor/jquery.Jcrop.js +1694 -0
  72. data/vendor/assets/javascripts/jquery-file-upload/vendor/templates/compile.js +84 -0
  73. data/vendor/assets/javascripts/jquery-file-upload/vendor/templates/demo.js +48 -0
  74. data/vendor/assets/javascripts/jquery-file-upload/vendor/templates/runtime.js +47 -0
  75. data/vendor/assets/javascripts/jquery-file-upload/vendor/templates/tmpl.js +87 -0
  76. data/vendor/assets/javascripts/jquery-file-upload/vendor/templates/tmpl.min.js +1 -0
  77. data/vendor/assets/stylesheets/jquery-file-upload/demo-ie8.css +21 -0
  78. data/vendor/assets/stylesheets/jquery-file-upload/demo.css +67 -0
  79. data/vendor/assets/stylesheets/jquery-file-upload/jquery.fileupload-noscript.css +22 -0
  80. data/vendor/assets/stylesheets/jquery-file-upload/jquery.fileupload-ui-noscript.css +17 -0
  81. data/vendor/assets/stylesheets/jquery-file-upload/jquery.fileupload-ui.css.scss +57 -0
  82. data/vendor/assets/stylesheets/jquery-file-upload/jquery.fileupload.css +36 -0
  83. data/vendor/assets/stylesheets/jquery-file-upload/style.css +15 -0
  84. metadata +196 -0
@@ -0,0 +1,138 @@
1
+ /*
2
+ * JavaScript Load Image Demo JS 1.9.1
3
+ * https://github.com/blueimp/JavaScript-Load-Image
4
+ *
5
+ * Copyright 2013, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /*global window, document, loadImage, HTMLCanvasElement, $ */
13
+
14
+ $(function () {
15
+ 'use strict';
16
+
17
+ var result = $('#result'),
18
+ exifNode = $('#exif'),
19
+ thumbNode = $('#thumbnail'),
20
+ actionsNode = $('#actions'),
21
+ currentFile,
22
+ replaceResults = function (img) {
23
+ var content;
24
+ if (!(img.src || img instanceof HTMLCanvasElement)) {
25
+ content = $('<span>Loading image file failed</span>');
26
+ } else {
27
+ content = $('<a target="_blank">').append(img)
28
+ .attr('download', currentFile.name)
29
+ .attr('href', img.src || img.toDataURL());
30
+ }
31
+ result.children().replaceWith(content);
32
+ if (img.getContext) {
33
+ actionsNode.show();
34
+ }
35
+ },
36
+ displayImage = function (file, options) {
37
+ currentFile = file;
38
+ if (!loadImage(
39
+ file,
40
+ replaceResults,
41
+ options
42
+ )) {
43
+ result.children().replaceWith(
44
+ $('<span>Your browser does not support the URL or FileReader API.</span>')
45
+ );
46
+ }
47
+ },
48
+ displayExifData = function (exif) {
49
+ var thumbnail = exif.get('Thumbnail'),
50
+ tags = exif.getAll(),
51
+ table = exifNode.find('table').empty(),
52
+ row = $('<tr></tr>'),
53
+ cell = $('<td></td>'),
54
+ prop;
55
+ if (thumbnail) {
56
+ thumbNode.empty();
57
+ loadImage(thumbnail, function (img) {
58
+ thumbNode.append(img).show();
59
+ }, {orientation: exif.get('Orientation')});
60
+ }
61
+ for (prop in tags) {
62
+ if (tags.hasOwnProperty(prop)) {
63
+ table.append(
64
+ row.clone()
65
+ .append(cell.clone().text(prop))
66
+ .append(cell.clone().text(tags[prop]))
67
+ );
68
+ }
69
+ }
70
+ exifNode.show();
71
+ },
72
+ dropChangeHandler = function (e) {
73
+ e.preventDefault();
74
+ e = e.originalEvent;
75
+ var target = e.dataTransfer || e.target,
76
+ file = target && target.files && target.files[0],
77
+ options = {
78
+ maxWidth: result.width(),
79
+ canvas: true
80
+ };
81
+ if (!file) {
82
+ return;
83
+ }
84
+ exifNode.hide();
85
+ thumbNode.hide();
86
+ loadImage.parseMetaData(file, function (data) {
87
+ if (data.exif) {
88
+ options.orientation = data.exif.get('Orientation');
89
+ displayExifData(data.exif);
90
+ }
91
+ displayImage(file, options);
92
+ });
93
+ },
94
+ coordinates;
95
+ // Hide URL/FileReader API requirement message in capable browsers:
96
+ if (window.createObjectURL || window.URL || window.webkitURL || window.FileReader) {
97
+ result.children().hide();
98
+ }
99
+ $(document)
100
+ .on('dragover', function (e) {
101
+ e.preventDefault();
102
+ e = e.originalEvent;
103
+ e.dataTransfer.dropEffect = 'copy';
104
+ })
105
+ .on('drop', dropChangeHandler);
106
+ $('#file-input').on('change', dropChangeHandler);
107
+ $('#edit').on('click', function (event) {
108
+ event.preventDefault();
109
+ var imgNode = result.find('img, canvas'),
110
+ img = imgNode[0];
111
+ imgNode.Jcrop({
112
+ setSelect: [40, 40, img.width - 40, img.height - 40],
113
+ onSelect: function (coords) {
114
+ coordinates = coords;
115
+ },
116
+ onRelease: function () {
117
+ coordinates = null;
118
+ }
119
+ }).parent().on('click', function (event) {
120
+ event.preventDefault();
121
+ });
122
+ });
123
+ $('#crop').on('click', function (event) {
124
+ event.preventDefault();
125
+ var img = result.find('img, canvas')[0];
126
+ if (img && coordinates) {
127
+ replaceResults(loadImage.scale(img, {
128
+ left: coordinates.x,
129
+ top: coordinates.y,
130
+ sourceWidth: coordinates.w,
131
+ sourceHeight: coordinates.h,
132
+ minWidth: result.width()
133
+ }));
134
+ coordinates = null;
135
+ }
136
+ });
137
+
138
+ });
@@ -0,0 +1,384 @@
1
+ /*
2
+ * JavaScript Load Image Exif Map 1.0.2
3
+ * https://github.com/blueimp/JavaScript-Load-Image
4
+ *
5
+ * Copyright 2013, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Exif tags mapping based on
9
+ * https://github.com/jseidelin/exif-js
10
+ *
11
+ * Licensed under the MIT license:
12
+ * http://www.opensource.org/licenses/MIT
13
+ */
14
+
15
+ /*global define, window */
16
+
17
+ (function (factory) {
18
+ 'use strict';
19
+ if (typeof define === 'function' && define.amd) {
20
+ // Register as an anonymous AMD module:
21
+ define(['load-image', 'load-image-exif'], factory);
22
+ } else {
23
+ // Browser globals:
24
+ factory(window.loadImage);
25
+ }
26
+ }(function (loadImage) {
27
+ 'use strict';
28
+
29
+ loadImage.ExifMap.prototype.tags = {
30
+ // =================
31
+ // TIFF tags (IFD0):
32
+ // =================
33
+ 0x0100: 'ImageWidth',
34
+ 0x0101: 'ImageHeight',
35
+ 0x8769: 'ExifIFDPointer',
36
+ 0x8825: 'GPSInfoIFDPointer',
37
+ 0xA005: 'InteroperabilityIFDPointer',
38
+ 0x0102: 'BitsPerSample',
39
+ 0x0103: 'Compression',
40
+ 0x0106: 'PhotometricInterpretation',
41
+ 0x0112: 'Orientation',
42
+ 0x0115: 'SamplesPerPixel',
43
+ 0x011C: 'PlanarConfiguration',
44
+ 0x0212: 'YCbCrSubSampling',
45
+ 0x0213: 'YCbCrPositioning',
46
+ 0x011A: 'XResolution',
47
+ 0x011B: 'YResolution',
48
+ 0x0128: 'ResolutionUnit',
49
+ 0x0111: 'StripOffsets',
50
+ 0x0116: 'RowsPerStrip',
51
+ 0x0117: 'StripByteCounts',
52
+ 0x0201: 'JPEGInterchangeFormat',
53
+ 0x0202: 'JPEGInterchangeFormatLength',
54
+ 0x012D: 'TransferFunction',
55
+ 0x013E: 'WhitePoint',
56
+ 0x013F: 'PrimaryChromaticities',
57
+ 0x0211: 'YCbCrCoefficients',
58
+ 0x0214: 'ReferenceBlackWhite',
59
+ 0x0132: 'DateTime',
60
+ 0x010E: 'ImageDescription',
61
+ 0x010F: 'Make',
62
+ 0x0110: 'Model',
63
+ 0x0131: 'Software',
64
+ 0x013B: 'Artist',
65
+ 0x8298: 'Copyright',
66
+ // ==================
67
+ // Exif Sub IFD tags:
68
+ // ==================
69
+ 0x9000: 'ExifVersion', // EXIF version
70
+ 0xA000: 'FlashpixVersion', // Flashpix format version
71
+ 0xA001: 'ColorSpace', // Color space information tag
72
+ 0xA002: 'PixelXDimension', // Valid width of meaningful image
73
+ 0xA003: 'PixelYDimension', // Valid height of meaningful image
74
+ 0xA500: 'Gamma',
75
+ 0x9101: 'ComponentsConfiguration', // Information about channels
76
+ 0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel
77
+ 0x927C: 'MakerNote', // Any desired information written by the manufacturer
78
+ 0x9286: 'UserComment', // Comments by user
79
+ 0xA004: 'RelatedSoundFile', // Name of related sound file
80
+ 0x9003: 'DateTimeOriginal', // Date and time when the original image was generated
81
+ 0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally
82
+ 0x9290: 'SubSecTime', // Fractions of seconds for DateTime
83
+ 0x9291: 'SubSecTimeOriginal', // Fractions of seconds for DateTimeOriginal
84
+ 0x9292: 'SubSecTimeDigitized', // Fractions of seconds for DateTimeDigitized
85
+ 0x829A: 'ExposureTime', // Exposure time (in seconds)
86
+ 0x829D: 'FNumber',
87
+ 0x8822: 'ExposureProgram', // Exposure program
88
+ 0x8824: 'SpectralSensitivity', // Spectral sensitivity
89
+ 0x8827: 'PhotographicSensitivity', // EXIF 2.3, ISOSpeedRatings in EXIF 2.2
90
+ 0x8828: 'OECF', // Optoelectric conversion factor
91
+ 0x8830: 'SensitivityType',
92
+ 0x8831: 'StandardOutputSensitivity',
93
+ 0x8832: 'RecommendedExposureIndex',
94
+ 0x8833: 'ISOSpeed',
95
+ 0x8834: 'ISOSpeedLatitudeyyy',
96
+ 0x8835: 'ISOSpeedLatitudezzz',
97
+ 0x9201: 'ShutterSpeedValue', // Shutter speed
98
+ 0x9202: 'ApertureValue', // Lens aperture
99
+ 0x9203: 'BrightnessValue', // Value of brightness
100
+ 0x9204: 'ExposureBias', // Exposure bias
101
+ 0x9205: 'MaxApertureValue', // Smallest F number of lens
102
+ 0x9206: 'SubjectDistance', // Distance to subject in meters
103
+ 0x9207: 'MeteringMode', // Metering mode
104
+ 0x9208: 'LightSource', // Kind of light source
105
+ 0x9209: 'Flash', // Flash status
106
+ 0x9214: 'SubjectArea', // Location and area of main subject
107
+ 0x920A: 'FocalLength', // Focal length of the lens in mm
108
+ 0xA20B: 'FlashEnergy', // Strobe energy in BCPS
109
+ 0xA20C: 'SpatialFrequencyResponse',
110
+ 0xA20E: 'FocalPlaneXResolution', // Number of pixels in width direction per FPRUnit
111
+ 0xA20F: 'FocalPlaneYResolution', // Number of pixels in height direction per FPRUnit
112
+ 0xA210: 'FocalPlaneResolutionUnit', // Unit for measuring the focal plane resolution
113
+ 0xA214: 'SubjectLocation', // Location of subject in image
114
+ 0xA215: 'ExposureIndex', // Exposure index selected on camera
115
+ 0xA217: 'SensingMethod', // Image sensor type
116
+ 0xA300: 'FileSource', // Image source (3 == DSC)
117
+ 0xA301: 'SceneType', // Scene type (1 == directly photographed)
118
+ 0xA302: 'CFAPattern', // Color filter array geometric pattern
119
+ 0xA401: 'CustomRendered', // Special processing
120
+ 0xA402: 'ExposureMode', // Exposure mode
121
+ 0xA403: 'WhiteBalance', // 1 = auto white balance, 2 = manual
122
+ 0xA404: 'DigitalZoomRatio', // Digital zoom ratio
123
+ 0xA405: 'FocalLengthIn35mmFilm',
124
+ 0xA406: 'SceneCaptureType', // Type of scene
125
+ 0xA407: 'GainControl', // Degree of overall image gain adjustment
126
+ 0xA408: 'Contrast', // Direction of contrast processing applied by camera
127
+ 0xA409: 'Saturation', // Direction of saturation processing applied by camera
128
+ 0xA40A: 'Sharpness', // Direction of sharpness processing applied by camera
129
+ 0xA40B: 'DeviceSettingDescription',
130
+ 0xA40C: 'SubjectDistanceRange', // Distance to subject
131
+ 0xA420: 'ImageUniqueID', // Identifier assigned uniquely to each image
132
+ 0xA430: 'CameraOwnerName',
133
+ 0xA431: 'BodySerialNumber',
134
+ 0xA432: 'LensSpecification',
135
+ 0xA433: 'LensMake',
136
+ 0xA434: 'LensModel',
137
+ 0xA435: 'LensSerialNumber',
138
+ // ==============
139
+ // GPS Info tags:
140
+ // ==============
141
+ 0x0000: 'GPSVersionID',
142
+ 0x0001: 'GPSLatitudeRef',
143
+ 0x0002: 'GPSLatitude',
144
+ 0x0003: 'GPSLongitudeRef',
145
+ 0x0004: 'GPSLongitude',
146
+ 0x0005: 'GPSAltitudeRef',
147
+ 0x0006: 'GPSAltitude',
148
+ 0x0007: 'GPSTimeStamp',
149
+ 0x0008: 'GPSSatellites',
150
+ 0x0009: 'GPSStatus',
151
+ 0x000A: 'GPSMeasureMode',
152
+ 0x000B: 'GPSDOP',
153
+ 0x000C: 'GPSSpeedRef',
154
+ 0x000D: 'GPSSpeed',
155
+ 0x000E: 'GPSTrackRef',
156
+ 0x000F: 'GPSTrack',
157
+ 0x0010: 'GPSImgDirectionRef',
158
+ 0x0011: 'GPSImgDirection',
159
+ 0x0012: 'GPSMapDatum',
160
+ 0x0013: 'GPSDestLatitudeRef',
161
+ 0x0014: 'GPSDestLatitude',
162
+ 0x0015: 'GPSDestLongitudeRef',
163
+ 0x0016: 'GPSDestLongitude',
164
+ 0x0017: 'GPSDestBearingRef',
165
+ 0x0018: 'GPSDestBearing',
166
+ 0x0019: 'GPSDestDistanceRef',
167
+ 0x001A: 'GPSDestDistance',
168
+ 0x001B: 'GPSProcessingMethod',
169
+ 0x001C: 'GPSAreaInformation',
170
+ 0x001D: 'GPSDateStamp',
171
+ 0x001E: 'GPSDifferential',
172
+ 0x001F: 'GPSHPositioningError'
173
+ };
174
+
175
+ loadImage.ExifMap.prototype.stringValues = {
176
+ ExposureProgram: {
177
+ 0: 'Undefined',
178
+ 1: 'Manual',
179
+ 2: 'Normal program',
180
+ 3: 'Aperture priority',
181
+ 4: 'Shutter priority',
182
+ 5: 'Creative program',
183
+ 6: 'Action program',
184
+ 7: 'Portrait mode',
185
+ 8: 'Landscape mode'
186
+ },
187
+ MeteringMode: {
188
+ 0: 'Unknown',
189
+ 1: 'Average',
190
+ 2: 'CenterWeightedAverage',
191
+ 3: 'Spot',
192
+ 4: 'MultiSpot',
193
+ 5: 'Pattern',
194
+ 6: 'Partial',
195
+ 255: 'Other'
196
+ },
197
+ LightSource: {
198
+ 0: 'Unknown',
199
+ 1: 'Daylight',
200
+ 2: 'Fluorescent',
201
+ 3: 'Tungsten (incandescent light)',
202
+ 4: 'Flash',
203
+ 9: 'Fine weather',
204
+ 10: 'Cloudy weather',
205
+ 11: 'Shade',
206
+ 12: 'Daylight fluorescent (D 5700 - 7100K)',
207
+ 13: 'Day white fluorescent (N 4600 - 5400K)',
208
+ 14: 'Cool white fluorescent (W 3900 - 4500K)',
209
+ 15: 'White fluorescent (WW 3200 - 3700K)',
210
+ 17: 'Standard light A',
211
+ 18: 'Standard light B',
212
+ 19: 'Standard light C',
213
+ 20: 'D55',
214
+ 21: 'D65',
215
+ 22: 'D75',
216
+ 23: 'D50',
217
+ 24: 'ISO studio tungsten',
218
+ 255: 'Other'
219
+ },
220
+ Flash: {
221
+ 0x0000: 'Flash did not fire',
222
+ 0x0001: 'Flash fired',
223
+ 0x0005: 'Strobe return light not detected',
224
+ 0x0007: 'Strobe return light detected',
225
+ 0x0009: 'Flash fired, compulsory flash mode',
226
+ 0x000D: 'Flash fired, compulsory flash mode, return light not detected',
227
+ 0x000F: 'Flash fired, compulsory flash mode, return light detected',
228
+ 0x0010: 'Flash did not fire, compulsory flash mode',
229
+ 0x0018: 'Flash did not fire, auto mode',
230
+ 0x0019: 'Flash fired, auto mode',
231
+ 0x001D: 'Flash fired, auto mode, return light not detected',
232
+ 0x001F: 'Flash fired, auto mode, return light detected',
233
+ 0x0020: 'No flash function',
234
+ 0x0041: 'Flash fired, red-eye reduction mode',
235
+ 0x0045: 'Flash fired, red-eye reduction mode, return light not detected',
236
+ 0x0047: 'Flash fired, red-eye reduction mode, return light detected',
237
+ 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',
238
+ 0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
239
+ 0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
240
+ 0x0059: 'Flash fired, auto mode, red-eye reduction mode',
241
+ 0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
242
+ 0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
243
+ },
244
+ SensingMethod: {
245
+ 1: 'Undefined',
246
+ 2: 'One-chip color area sensor',
247
+ 3: 'Two-chip color area sensor',
248
+ 4: 'Three-chip color area sensor',
249
+ 5: 'Color sequential area sensor',
250
+ 7: 'Trilinear sensor',
251
+ 8: 'Color sequential linear sensor'
252
+ },
253
+ SceneCaptureType: {
254
+ 0: 'Standard',
255
+ 1: 'Landscape',
256
+ 2: 'Portrait',
257
+ 3: 'Night scene'
258
+ },
259
+ SceneType: {
260
+ 1: 'Directly photographed'
261
+ },
262
+ CustomRendered: {
263
+ 0: 'Normal process',
264
+ 1: 'Custom process'
265
+ },
266
+ WhiteBalance: {
267
+ 0: 'Auto white balance',
268
+ 1: 'Manual white balance'
269
+ },
270
+ GainControl: {
271
+ 0: 'None',
272
+ 1: 'Low gain up',
273
+ 2: 'High gain up',
274
+ 3: 'Low gain down',
275
+ 4: 'High gain down'
276
+ },
277
+ Contrast: {
278
+ 0: 'Normal',
279
+ 1: 'Soft',
280
+ 2: 'Hard'
281
+ },
282
+ Saturation: {
283
+ 0: 'Normal',
284
+ 1: 'Low saturation',
285
+ 2: 'High saturation'
286
+ },
287
+ Sharpness: {
288
+ 0: 'Normal',
289
+ 1: 'Soft',
290
+ 2: 'Hard'
291
+ },
292
+ SubjectDistanceRange: {
293
+ 0: 'Unknown',
294
+ 1: 'Macro',
295
+ 2: 'Close view',
296
+ 3: 'Distant view'
297
+ },
298
+ FileSource: {
299
+ 3: 'DSC'
300
+ },
301
+ ComponentsConfiguration: {
302
+ 0: '',
303
+ 1: 'Y',
304
+ 2: 'Cb',
305
+ 3: 'Cr',
306
+ 4: 'R',
307
+ 5: 'G',
308
+ 6: 'B'
309
+ },
310
+ Orientation: {
311
+ 1: 'top-left',
312
+ 2: 'top-right',
313
+ 3: 'bottom-right',
314
+ 4: 'bottom-left',
315
+ 5: 'left-top',
316
+ 6: 'right-top',
317
+ 7: 'right-bottom',
318
+ 8: 'left-bottom'
319
+ }
320
+ };
321
+
322
+ loadImage.ExifMap.prototype.getText = function (id) {
323
+ var value = this.get(id);
324
+ switch (id) {
325
+ case 'LightSource':
326
+ case 'Flash':
327
+ case 'MeteringMode':
328
+ case 'ExposureProgram':
329
+ case 'SensingMethod':
330
+ case 'SceneCaptureType':
331
+ case 'SceneType':
332
+ case 'CustomRendered':
333
+ case 'WhiteBalance':
334
+ case 'GainControl':
335
+ case 'Contrast':
336
+ case 'Saturation':
337
+ case 'Sharpness':
338
+ case 'SubjectDistanceRange':
339
+ case 'FileSource':
340
+ case 'Orientation':
341
+ return this.stringValues[id][value];
342
+ case 'ExifVersion':
343
+ case 'FlashpixVersion':
344
+ return String.fromCharCode(value[0], value[1], value[2], value[3]);
345
+ case 'ComponentsConfiguration':
346
+ return this.stringValues[id][value[0]] +
347
+ this.stringValues[id][value[1]] +
348
+ this.stringValues[id][value[2]] +
349
+ this.stringValues[id][value[3]];
350
+ case 'GPSVersionID':
351
+ return value[0] + '.' + value[1] + '.' + value[2] + '.' + value[3];
352
+ }
353
+ return String(value);
354
+ };
355
+
356
+ (function (exifMapPrototype) {
357
+ var tags = exifMapPrototype.tags,
358
+ map = exifMapPrototype.map,
359
+ prop;
360
+
361
+ // Map the tag names to tags:
362
+ for (prop in tags) {
363
+ if (tags.hasOwnProperty(prop)) {
364
+ map[tags[prop]] = prop;
365
+ }
366
+ }
367
+ }(loadImage.ExifMap.prototype));
368
+
369
+ loadImage.ExifMap.prototype.getAll = function () {
370
+ var map = {},
371
+ prop,
372
+ id;
373
+ for (prop in this) {
374
+ if (this.hasOwnProperty(prop)) {
375
+ id = this.tags[prop];
376
+ if (id) {
377
+ map[id] = this.getText(id);
378
+ }
379
+ }
380
+ }
381
+ return map;
382
+ };
383
+
384
+ }));