Skip to content

Commit

Permalink
Include all image sizes on the media upload object (if they exist) (#…
Browse files Browse the repository at this point in the history
…7605)

* Include all image sizes on the media upload object (if they exist)

* Introduce `mediaDetails` attribute; only define `sizes` when exists

* Fix linting issue

* Make this back into a constant
  • Loading branch information
danielbachhuber committed Jul 3, 2018
1 parent 1b2db4e commit 30f25b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/mediaupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ export function mediaUpload( {
link: savedMedia.link,
title: savedMedia.title.raw,
url: savedMedia.source_url,
mediaDetails: {},
};
if ( has( savedMedia, [ 'media_details', 'sizes' ] ) ) {
mediaObject.mediaDetails.sizes = get( savedMedia, [ 'media_details', 'sizes' ], {} );
}
setAndUpdateFiles( idx, mediaObject );
},
( response ) => {
Expand Down

0 comments on commit 30f25b9

Please sign in to comment.