Changeset 22041
- Timestamp:
- 09/27/2012 05:52:42 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/plupload/wp-plupload.js
r21814 r22041 143 143 this.uploader.bind( 'FilesAdded', function( up, files ) { 144 144 _.each( files, function( file ) { 145 file.attachment = wp.media.model.Attachment.create( _.extend({ 145 var attributes, image; 146 147 // Generate attributes for a new `Attachment` model. 148 attributes = _.extend({ 146 149 file: file, 147 150 uploading: true, 148 151 date: new Date() 149 }, _.pick( file, 'loaded', 'size', 'percent' ) ) ); 152 }, _.pick( file, 'loaded', 'size', 'percent' ) ); 153 154 // Handle early mime type scanning for images. 155 image = /(?:jpe?g|png|gif)$/i.exec( file.name ); 156 157 // Did we find an image? 158 if ( image ) { 159 attributes.type = 'image'; 160 161 // `jpeg`, `png` and `gif` are valid subtypes. 162 // `jpg` is not, so map it to `jpeg`. 163 attributes.subtype = ( 'jpg' === image[0] ) ? 'jpeg' : image[0]; 164 } 165 166 // Create the `Attachment`. 167 file.attachment = wp.media.model.Attachment.create( attributes ); 150 168 151 169 Uploader.queue.add( file.attachment );
Note: See TracChangeset
for help on using the changeset viewer.