Make Result class containt Java's BufferedImage field #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 addedisReadableImage
field, which is set whenever any of the 3 constructors is called.In
Utils
, I've writtenisReadableImage
methods. They take a reference to image source in forms of base64-encoded string, simple String path or instance ofURL
class. I've also written tests for them which pass (they test for both files that are images, and for simple .txt file). Note: theisReadableImage
method will not returntrue
for every image asImageIO.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.