MCPcopy Index your code
hub / github.com/blueimp/JavaScript-Load-Image / replaceHead

Function replaceHead

js/load-image-meta.js:210–224  ·  view source on GitHub ↗

* Replaces the image head of a JPEG blob with the given one. * Returns a Promise or calls the callback with the new Blob. * * @param {Blob} blob Blob object * @param {ArrayBuffer} head New JPEG head * @param {Function} [callback] Callback function * @returns {Promise |und

(blob, head, callback)

Source from the content-addressed store, hash-verified

208 * @returns {Promise<Blob|null>|undefined} Combined Blob
209 */
210 function replaceHead(blob, head, callback) {
211 var options = { maxMetaDataSize: 1024, disableMetaDataParsers: true }
212 if (!callback && global.Promise) {
213 return parseMetaData(blob, options).then(function (data) {
214 return replaceJPEGHead(blob, data.imageHead, head)
215 })
216 }
217 parseMetaData(
218 blob,
219 function (data) {
220 callback(replaceJPEGHead(blob, data.imageHead, head))
221 },
222 options
223 )
224 }
225
226 loadImage.transform = function (img, options, callback, file, data) {
227 if (loadImage.requiresMetaData(options)) {

Callers

nothing calls this directly

Calls 2

parseMetaDataFunction · 0.85
replaceJPEGHeadFunction · 0.85

Tested by

no test coverage detected