dimanche 29 décembre 2019

Thymeleaf Dynamic Image

I have a SpringBoot application where the user can store a profile picture, save an image in C: / imgPerfil / concatenating or user id + the original image name, for example: "2teste.jpeg", I need to show this image in front using thymeleaf how to do this? The Path is saved inside the Object used in the variable photo, it is also displayed in the data by Ajax.`

var nome; var foto; $.ajax({ url: '/getPerfil', type: 'GET', success: function (perfil) { nome = perfil[0].nome; foto = perfil[0].foto; console.log(perfil[0]); $("#nomeUsuario").text(nome); $("fotoUsuario").attr('src', foto); } });

How to display this image?`




Aucun commentaire:

Enregistrer un commentaire