liveblog icon indicating copy to clipboard operation
liveblog copied to clipboard

app.js – Insert media – TypeError: e.media_details.sizes is undefined

Open creativeagent opened this issue 7 years ago • 4 comments

Hi,

we get an error, if we click the button “Insert Media”, the script die and return; in the console the following error: “e.media_details.sizes is undefined”

btw, other persons have this error too: https://wordpress.org/support/topic/app-js-insert-media-typeerror-e-media_details-sizes-is-undefined/

br Stephan

creativeagent avatar Aug 31 '18 06:08 creativeagent

We had an issue with our specific wordpress install. We had different crop names to the wordpress default. See https://github.com/Automattic/liveblog/issues/452

cain avatar Sep 03 '18 00:09 cain

Could you share any more details on the circumstances in which this manifests itself? Is it reproducable in a vanilla install and if not, what additions make it happen?

philipjohn avatar Sep 27 '18 11:09 philipjohn

@philipjohn Not sure of every circumstance, but if the crop type doesnt exist it will break. I think it will be a good idea just to add an extra conditional, since there are a number of people creating these issues. https://github.com/Automattic/liveblog/pull/453/files#diff-02705067ba05489137df59bec522f5b7R17

cain avatar Sep 28 '18 00:09 cain

solution 👍#626 only needs to add single line ie . if (!image || !image.media_details || !image.media_details.sizes) return ''; in getImageThumbnail function var getImageThumbnail = function getImageThumbnail(image) { if (!image || !image.media_details || !image.media_details.sizes) return ''; if (image.media_details.sizes.thumbnail) { return image.media_details.sizes.thumbnail.source_url; } return ''; };

deepakrohillas avatar Mar 14 '19 09:03 deepakrohillas