diff --git a/app/assets/javascripts/admin/modules/image-processing-checker.js b/app/assets/javascripts/admin/modules/image-processing-checker.js index d6cb68e409d..a1092c9f14d 100644 --- a/app/assets/javascripts/admin/modules/image-processing-checker.js +++ b/app/assets/javascripts/admin/modules/image-processing-checker.js @@ -9,6 +9,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {} constructor($root) { this.$root = $root this.imageLink = this.$root.dataset.imageLink + this.variant = this.$root.dataset.variant || 'original' this.timeoutDuration = parseInt(this.$root.dataset.timeoutDuration, 10) || @@ -95,13 +96,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {} if (imgElement) { const previewAsset = assets.find( - ({ variant }) => variant !== 'original' + ({ variant }) => variant === this.variant ) - // images with multiple assets can have - // transformed variants so we should not use - // the `original` asset if this is the case - imgElement.src = previewAsset ? previewAsset.url : assets[0].url + imgElement.src = previewAsset.url } this.updateImageStatus(this.imagePreview) diff --git a/app/components/admin/edition_images/image_component.html.erb b/app/components/admin/edition_images/image_component.html.erb index c8fda618341..d1d3595a354 100644 --- a/app/components/admin/edition_images/image_component.html.erb +++ b/app/components/admin/edition_images/image_component.html.erb @@ -1,4 +1,4 @@ -