Skip to content

Make Result class containt Java's BufferedImage field #30

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

IceMajor2
Copy link

Hi. I've been recently using ImageKit library for Java, mainly for uploading images programmatically. Throughout my not-so-long experimenting with it, I've found that it may perhaps be helpful to have a ready-to-use Java AWT's image object after having sent an image to external hosting (ImageKit :) ).

I've taken a stab at trying to accomplish so.

GOAL: Result class contains BufferedImage field

Problem: Not every file needs to be an image and not every image will neccessarily be read by ImageIO.read.
In FileCreateRequest class, I've added isReadableImage field, which is set whenever any of the 3 constructors is called.
In Utils, I've written isReadableImage methods. They take a reference to image source in forms of base64-encoded string, simple String path or instance of URL class. I've also written tests for them which pass (they test for both files that are images, and for simple .txt file). Note: the isReadableImage method will not return true for every image as ImageIO.read does not support every format. For example, in order to read .webp images this way, we would additionally need plugins, which I've not included.

I've also thought of creating another Result class, especially for images, but I realised it may be too much at once ;)

This is my first contribution to open source project, I'd love some feedback. I'm open to work on this as well as on other issues.

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

Successfully merging this pull request may close these issues.

1 participant