Untitled
unknown
java
4 years ago
1.1 kB
9
Indexable
public static byte[] cargaImagenContent(String codigo) {
if (codigo != null && codigo.length() > 1) {
BufferedImage fotoContent = EngagemeFilesUtil
.cargarBufferedImage(AppGlobalConfig.getSchema() + "/"
+ codigo);
if (fotoContent != null) {
ByteArrayOutputStream os = null;
try {
// Reduce imagen a max 300 width
BufferedImage scaledImage = Scalr.resize(fotoContent, 300);
os = new ByteArrayOutputStream();
ImageIO.write(scaledImage, "png", os);
return os.toByteArray();
} catch (IOException ex) {
} finally {
if (os != null) {
try {
os.close();
} catch (IOException ex) {
}
}
}
}
}
return null;
}Editor is loading...