[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> media-utils.js (summary)

WordPress dependencies

File Size: 711 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MediaUpload:: (2 methods):
  getMimeTypesArray()
  createMediaFromFile()


Class: MediaUpload  - X-Ref

getMimeTypesArray(wpMimeTypesObject)   X-Ref
Browsers may use unexpected mime types, and they differ from browser to browser.
This function computes a flexible array of mime types from the mime type structured provided by the server.
Converts { jpg|jpeg|jpe: "image/jpeg" } into [ "image/jpeg", "image/jpg", "image/jpeg", "image/jpe" ]
The computation of this array instead of directly using the object,
solves the problem in chrome where mp3 files have audio/mp3 as mime type instead of audio/mpeg.
https://bugs.chromium.org/p/chromium/issues/detail?id=227004

return: {?Array} An array of mime types or the parameter passed if it was "falsy".
param: {?Object} wpMimeTypesObject Mime type object received from the server.

createMediaFromFile(file, additionalData)   X-Ref

return: {Promise} Media Object Promise.
param: {File}    file           Media File to Save.
param: {?Object} additionalData Additional data to include in the request.



Generated : Tue Apr 23 08:20:01 2024 Cross-referenced by PHPXref