SteemJ-Image-Upload has been released ~ Upload Images to steemitimages.com out of your Java Application

in #utopian-io7 years ago (edited)

Ever wondered how to upload images to Steemit? Simply use SteemJ Image Upload.


SteemJImageUploadLogo

SteemJ-Image-Upload has been released ~ Upload Images to steemitimages.com out of your Java Application

Hello Steemians!

I am more than proud to share my latest project with you: SteemJ Image Upload. This small application allows you to upload images to the official Steemit Image Hoster https://steemitimages.com out of your Java application.

It has been more than 11 months ago that I've announced the first version of SteemJ and during this long time, one of the most asked questions was:

How can I upload an image and add it to my post?

While writing a post has become really easy with SteemJ, uploading an image was still not supported. Therefore, my answer so far was to use a third party hoster like https://imgur.com, which results in additional work for the user as you need to take care of creating/finding an API for Java, create an additional account for the Hoster and much more.

So in general I think both of us, you as a user, and I as the guy behind SteemJ, were not really happy with this answer. I already know that Steemit itself is offering an Image Hoster (https://steemitimages.com) since several months, but after they removed the web interface I had no idea how to upload images now.

In the last weeks I took a lot of my free time to figure out how the upload to steemitimages.com works and some days ago I did my first successful upload! The last days have been spent to put everything into a small lib and now I feel ready to share a first pre-release with you.

The main target is, again, to collect some feedback and to find potential bugs, so if you have some time left it would be really great if you could try it out and report about it.

How can I use it - Quick Start Guide

Add SteemJ Image Upload to your project

SteemJ Image Upload binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven.

File: pom.xml

<dependency>
    <groupId>eu.bittrade.libs</groupId>
    <artifactId>steemj-image-upload</artifactId>
    <version>1.0.0pre1</version>
</dependency>

Create a sample Application

SteemJ Image Upload is really easy to use. The following code shows a full sample:

import java.io.File;
import java.io.IOException;
import java.net.URL;

import eu.bittrade.libs.steemj.base.models.AccountName;
import eu.bittrade.libs.steemj.image.upload.SteemJImageUpload;

public class ExampleApplication {
    public static void main(String args[]) {
        AccountName myAccount = new AccountName("dez1337");
        // Please be informed that this is not the correct private key of dez1337.
        String myPrivatePostingKeyAsWif = "5KMamixsFoUkdlz7sNG4RsyaKQyJMBBqrdT6y54qr4cdVhU9rz7";
        File imageToUpload = new File("C:/Users/dez1337/Desktop/SteemJImageBanner.png");

        try {
            URL myImageUrl = SteemJImageUpload.uploadImage(myAccount, myPrivatePostingKeyAsWif, imageToUpload);
            System.out.println("The image has been uploaded and is reachable using the URL: " + myImageUrl);
        } catch (IOException e) {
            System.out.println("There was a problem uploading the image.");
            e.printStackTrace();
        }
    }
}

An output of the code above will look like this:

The image has been uploaded and is reachable using the URL: https://steemitimages.com/DQmfWn1z6HwwxfaWhrpY28MYh43wEEyNsV25GnGSGZUDo2U/SteemJImageSteemFriendlyWithUpdatetBanner.png

As you can see in the sample above, your account name and your private posting are required to upload an image - If you do not provide those details, your upload request will not be accepted.

If you have security doupts about it you can:

Contribute

If you want to support the project simply clone the git repository and submit a pull request.

git clone https://github.com/marvin-we/steemj-image-upload.git

Additional Information

You can find additional information and also the source code on GitHub.

https://github.com/marvin-we/steemj-image-upload

Get in touch!

Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.


If you want to stay up to date or just like the stuff I am doing it would be great if you leave me a like, resteem the post and/or follow me.

Thanks for reading and best regards,
@dez1337



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

The code reads like there is a signing requirement for uploading pictures. The private posting key. Am I reading that correctly?

Also is there an acceptable use document on using their images API anywhere?

Hay @muksihs,

The code reads like there is a signing requirement for uploading pictures. The private posting key. Am I reading that correctly?

Ohh I totally missed to explain this part. Sorry for that - I will edit the post later on when I am at home again.

The quick answer is yes. They only allow users with a steem account to upload images.

Also is there an acceptable use document on using their images API anywhere?

You can check the readme:
https://github.com/steemit/imagehoster/blob/master/README.md

At the beginning it was totally not clear to me 🙈 But now that I know how it works I would say the documentation is really minimal, but its correct.

thank you for this contribution I liked the post and I liked it. Waiting for the future @dez1337

Thanks a lot @eliashossain 😊💪

Wow! Thanks for the enlightenment

Thanks @timmyeu =)

That's great

Thanks a lot @tyvain :)

java una excelente plataforma para usar con steemit

Thanks 😊👌

DE NADA QUE TAL UN LIKE POR LIKE?

Sorry I just saw this. I'm also a Java developer and would like to see a library that I can use in a Spring application similar to steem-js, but not as a javascript library.

Hay @eastmael -Great to see you here :)

As you may have seen I also develop steemj, which is a steem api for java and it should also work with spring :) Feel free to ping me on steemit.chat or leave me a comment in case you face an issue 👌😊

Awesome. Great to see more Java APIs.

Thanks @sanjeevm :) Great to see you here again! :)

Hey guys, I hope you can help me clarify this. Is the SteemJ API a library to create new Steem-based blockchains or it provides interaction with the same blockchain that Utopian and Steemit are using? I'm just curious to get on the developer mode some day.

Btw, I know this post is specifically about SteemJ-Image-Upload, but it's the most recent official post on SteemJ at this time, so I thought I could get very useful feedback here... and maybe help more people with your clarifications :)

Hay @chris2jh ,

thanks for your question :) Lets see if I can answer everything:

Is the SteemJ API a library to create new Steem-based blockchains or it provides interaction with the same blockchain that Utopian and Steemit are using?

So a Steem node offers an API by default (It is using JSON RPC) - SteemJ is a wrapper for this api written in Java and allows you to interact (Post, Vote, Transfer, .. ) with the Steem blockchain.

Utopian is an initiative that rewards open source contributors. So basically it is a way for me to earn some more rewards for the work I've done.

I'm just curious to get on the developer mode some day.

I am more than interested in collecting feedback - Most of the best improvements are best on the ideas and questions of users. So if you want to start something with SteemJ feel free to ping me on discord or on steemit.chat and I will try my best to help you :)

@dez1337 I really appreciate your explanation. I hope in the future I will provide you with very useful feedback on SteemJ ;)

This is awesome @dez1337

Thanks a lot @toffer :)

extremly favourite of steemit day by day