Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image with bad resolution is still selected #19

Open
lukonjun opened this issue Mar 6, 2022 · 0 comments
Open

Image with bad resolution is still selected #19

lukonjun opened this issue Mar 6, 2022 · 0 comments

Comments

@lukonjun
Copy link
Owner

lukonjun commented Mar 6, 2022

Articles are fetched from RSS Feeds where img_url is provided. Especially for publisher Bild, the images have low quality.

Expected State:
If the image of an article has a low resolution, it should be replaced with the url_to_image of the publisher.

Current State:
Images with low resolution are still imported.

1302,2022-02-27 19:37:20.366715,2022-02-27 19:41:32.853382,NULL,2,,NULL,1,"<img src=""https://bilder.bild.de/fotos-skaliert/bayer-leverkusen-lucas-alario-im-doppelten-tor-glueck-ae51603c5c2f4f5bb3645d2b729d5d2c-79290698/1,w=120,c=0.bild.jpg"" alt=""Bayer Leverkusen: Lucas Alario im doppelten Tor-Glück"" align=""left"" style=""padding-right:5px;"" />Der lange gefrustete Edel-Joker war nach Schicks Ausfall gefragt – und schoss sich und Bayer ins doppelte Tor-Glück.<br />Foto: Peter Seydel/Jan Huebner<br />            ",https://www.bild.de/sport/fussball/fussball/bayer-leverkusen-lucas-alario-im-doppelten-tor-glueck-79289808.bild.html,true,true,false,2022-02-27 09:56:52,23,Schick-Ersatz liefert - Alario im doppelten Tor-Glück,https://www.bild.de/sport/fussball/fussball/bayer-leverkusen-lucas-alario-im-doppelten-tor-glueck-79289808.bild.html,"https://bilder.bild.de/fotos-skaliert/bayer-leverkusen-lucas-alario-im-doppelten-tor-glueck-ae51603c5c2f4f5bb3645d2b729d5d2c-79290698/1,w=120,c=0.bild.jpg"

The responsible Code Snippet can be found here
ArticleServiceImpl.java

    private Dimension getImageDimension(String imageUrl) {

        BufferedImage image;
        URL url = null;
        try {
            url = new URL(imageUrl);
            image = ImageIO.read(url);


//            TODO size checking

//            DataBuffer dataBuffer = image.getData().getDataBuffer();
//            long sizeBytes = ((long) dataBuffer.getSize()) * 4L;
//            long sizeMB = sizeBytes / (1024L * 1024L);

            return new Dimension(image.getHeight(), image.getWidth());

        } catch (IOException e) {
            throw new GeneralException("Error while get the resolution of the image", String.valueOf(url));
        }

    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant