A small application for automatically syncing image folders with imgur.
Currently this application is little more than a minimal viable product so the features are small and the bugs are likely many.
To have the applicaiton attempt to sync a directory with imgur you must have two things:
- An imgur album (made with your account) and
- A directory/folder on disk containing images
Simply create a new file in the albums/
directory (by default) using the album ID as the filename, such as h2sn8.txt
or h2sn8.album
.
The contents of this file should be the path of the target directory/folder from which the images will be pulled, such as C:\Users\Tom\Desktop\Photos
or C:\Users\Tom\Pictures
.
Upon execution, the application will now cross reference the images found in the specified directory with those in the corresponding album and upload any that were missing.
In order to run and use this application you require both an Imgur account and a set of application keys.
If you do not have an imgur account you can sign up for one at: imgur.com/register
If you do not have a registered application you must sign up for one at: api.imgur.com/oauth2/addclient
Simply fill out the form with the required information and ignore fields related to Authorization type and callback as they are unneccessary to the execution of this program.
After successfully registering your application, Imgur will respond via the email address provided. Contained within this email should be two critical pieces of information, your client-id
and client secret
.
Save these for later.
This application does not have an automatic authorization process in place, instead you must do so manually.
To do so, modify the following link with the client ID you received after registering your application and follow it:
https://api.imgur.com/oauth2/authorize?response_type=token&client_id=YOUR_CLIENT_ID_HERE
You may be asked to log into your Imgur account if not already and authorize the application. Upon doing so you will be redirected to a non-existent page.
Contained within the parameters of this redirect are some of the keys/tokens neccessary for operation of this application. Extract the refresh token, as seen above, and have it on hand.
This lengthy process has now given you the three pieces of information you require to properly configure this application.
Open src/main/resources/application.properties
and replace the null values with your keys so it resembles something like:
CLIENT_ID=1a2b3c4d
CLIENT_SECRET=onetwothreefourfivesixseveneight
REFRESH_TOKEN=notarealkey
From here you should be able to simply run or package the application like you would any other Maven project.
- Spring Boot - For requesting and parsing JSON into POJO's
- Maven - For dependency/build management
- Java - ...
- Eclipse - Blessed be the IDE, even if it does cause hair loss.
- github.com/ThomGeG/Toms-Image-Uploader/tree/Python - A deprecated Python version of this program.
- api.imgur.com - The official API documentation that this application utilizes.