liveblog
liveblog copied to clipboard
app.js – Insert media – TypeError: e.media_details.sizes is undefined
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
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
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 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
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 ''; };