Add an image preview to the product page
Last updated
<script>
$(function() {
$(document).on('previewSuccess', 'form[data-uploadery]', function(e) {
if (e.originalEvent.detail.preview === '') {
return;
}
var $title = $('<p></p>').html('Preview:');
var $img = $('<img/>').attr('src', e.originalEvent.detail.preview);
var $uploaderyResponse = $('<div></div>').attr('class', 'uploaderyResponse').html([$title, $img]);
$(e.target).next('.uploaderyResponse').remove();
$(e.target).after($uploaderyResponse);
});
});
</script>.uploaderyResponse {
display: inline-block;
width: 100%;
max-width: 100%;
text-align: center;
padding: 10px;
background: #F5F5F5;
box-sizing: border-box;
border: 1px solid #ececec;
margin-bottom: 10px;
margin-top: 10px;
}
.uploaderyResponse p {
width: 100%;
}