that kind of thinking lives in the older world of primarily text-based posts and when images were scarce. John Maeda • Design at WordCamp US 2016 make.wordpress.org/design/2016/12/04/design-at-wordcamp-us-2016 “ ”
uploading API to deliver a consistent file uploading experience in the browser. Regardless of the method used, an upload is sent to WordPress in the form of an HTTP Post request.
file data to the filesystem. For most uploads, this is done in wp_handle_upload(). Before saving the file, check: • User capabilities • Is filesystem is writable • The filetype is allowed Returns an array containing the file path, URL, and type on success.
combination of a WP_Post object with specialized post meta values. WordPress combines data passed in the upload request with data from the file itself to build post properties like title, content, and excerpt Once assembled, an attachment array is saved to the database using wp_insert_attachment() (or wp_insert_post() in the REST API).
file path relative to the uploads directory 3. Build an array of intermediate sizes to create by combining default image sizes with those defined by add_image_size() 4. Use wp_get_image_editor() to get a WP_Image_Editor for creating intermediate files. Default image editors use either ImageMagick or GD. 5. Pass the array of sizes to the editor's mulit-resize() method. Make the files, return the data. 6. Extract EXIF/IPTC data (aperture, credit, camera, copyright, shutter speed, ISO, etc.)
2. That’s it. well… unless… If the ID3 data includes a cover image, we need to process that file like an image upload and save it as the `post_thumbnail` for the audio or video attachment post. Neat.
the attachment metadata, it is saved to the database using the function wp_update_attachment_metadata() and the attachment ID is returned. Note: Additional metadata, like the `alt` attribute value, and context (for custom headers) may also be generated.
the file, creating an attachment post, and saving all relevant metadata, it can prepare the response to send back to the client. Traditionally this will use wp_prepare_attachment_for_js() to create a JSON representation of the attachment. The REST API, returns a response which is similar, but not identical. Server errors return as an HTTP 503 error.
us, but here are some ideas: 1. Asynchronous image generation 2. Make media a first-class data type (WP_Image) 3. Streamline integration for 3rd party services 5. Post-upload image optimization (ImageOptim) 6. Support modern formats (WebP, SVG) 7. ¯\_(ツ)_/¯ Media Handling in WordPress Explained