ImgurQt

ImgurQt is a console application based on Qt that implements a part of imgur.com's APIv3. It allows authentication with a user account, uploading images to either the connected account or anonymously, and also implements deletion of an image using the provided deletion hash.

History:

ImgurQt wasn't initially planned at all. It was born out of the decision to implement this functionality in PhotoQt, and along the way it seemed like a logical step to publish it separately for standalone use, too. That's it, not a very exciting history...

Standalone application:

ImgurQt functions as a standalone application. After compiling, you can call it with various command-line flags to handle simple imgur.com-related tasks. To see a list of how to do the different things, simply run it without any commandline flag or pass -h/--help. Once an image was successfully uploaded (either to an account or anonymously), ImgurQt provides the image URL and a deletion hash. The image URL can now be shared with others, and the deletion hash can be used to delete the image (who would have thought) either by passing it back into ImgurQt or by calling the respective URL.

Use it as part of your own application:

All the functionality of authenticating/uploading/deleting images to/from imgur.com is contained in a few files. They are located in the subdirectory src/ of the source tree. In order to make use of them in your own code, simply follow these steps:
  1. Include imgur.h in your own project
  2. Adjust the client_id and client_secret in config.h to the ones you obtain yourself (please be fair, get your own for your own project)
  3. Add imgur.cpp and simplecrypt.cpp to the list of files to be compiled
  4. Start using it
ImgurQt itself is nothing but a simple example as to how this can be used in practise. Thus, the file main.cpp should give you a good idea as to the necessary steps to perform the various tasks.

One important thing to note:
The authentication data is not stored in plaintext, but using a very simple encryption algorithm. This algorithm requires an integer when initialised that serves as the key for en-/decryption. In the code, the macro SIMPLECRYPTKEY is used. ImgurQt handles this by creating a random integer when running cmake the very first time and passes it on as the value of the aforementioned macro. If this macro is not provided (i.e., it will result in the integer value 0 for the key), then there is a random pre-defined integer near the top of imgur.cpp that is being used to serve the same purpose. When incorporating these scripts in your own application, feel free to adapt this handling of the random key or adjust it to your liking. Obviously, just ensure that the key used is the same every time your application is run!

Bugs

ImgurQt only provides very few features, so all of them have been tested to make sure they work. However, sometimes imgur.com returns an error or corrupt data, and it is possible that not all of these errors are handled in the optimal way (I tried to keep it as flexible as possible). If you come across anything that needs attention, please let me know. You can either open an issue on GitLab, or send me an email: (you need to enable javascript to see the email address).

Enjoy ImgurQt :-)