Skip to content

Thumbnail generation fails for certain image types #223

@BaolCristian

Description

@BaolCristian

Description:
I have encountered an issue where the library fails to generate thumbnails for specific types of images. Below are the details:
• Problem: When trying to create thumbnails for certain image files, the process fails and no thumbnail is generated.
• Image Types Affected: PNG (in attach)
• Error Details: no errors, but the file is not saved
• Steps to Reproduce:

                InputStream is = new BufferedInputStream(img.getBinaryStream())
                def result=Thumbnails.of(is).size(width, height).asBufferedImage()
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                ImageIO.write(result, "jpeg", os);
                // Passing: ​(RenderedImage im, String formatName, OutputStream output)
                InputStream fis = new ByteArrayInputStream(os.toByteArray());
                Connection conn = dataSource.getConnection()
                PreparedStatement pst
                if (isMax) pst = conn.prepareStatement("UPDATE FILES SET thumbnail_max = ? WHERE ID = ?")
                else pst = conn.prepareStatement("UPDATE FILES SET thumbnail = ? WHERE ID = ?")
                //= conn.prepareStatement("UPDATE FILES SET thumbnail = ? WHERE ID = ?")
                pst.setBinaryStream(1, fis, fis.available())
                pst.setLong(2, image.id)
                def index = pst.executeUpdate()
                pst.close()
                conn.close()

Environment:
• Library version: 0.4.20
• Operating System: MAC OS X /LINUX
• Programming Language and Version: GRAILS 4

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions