I have a form in which I get an image. And through a Java library
Thumbnailator GIT MANA Repo Thumbnailator
And I do these steps:
//Transformamos en un array de bit la imagen
byte[] contents = file.getBytes();
//Escala la imagen y la convierte en un array de bits para luego pasarlo a tipo Blob
Thumbnails.Builder<? extends InputStream> contentsAux = Thumbnails.of(new ByteArrayInputStream(contents))
.size(500, 600)
.outputFormat("png");
//Casteo la imagen para añadirla en una BD
Blob blob = new SerialBlob((Blob) contentsAux);
The problem that the server returns to me is the following:
There was an unexpected error (type = Internal Server Error, status = 500). net.coobird.thumbnailator.Thumbnails $ Builder can not be cast to java.sql.Blob
Apparently you can not cast and I do not know what alternative I can choose to choose