A Simple and Practical Image Hosting Program Developed Using the Picture Library API

Publish: 2015-11-09 | Modify: 2017-06-21

What is a picture bed program? It is a program specifically used to store images and allows you to link the images to online spaces. There are free picture hosting services available, which also provide related API interfaces. I have written a simple and practical picture bed program during my spare time. The code is very simple, consisting of only one single-page HTML file and a JavaScript script, without relying on any backend scripts. Let's take a detailed look at the introduction and usage.

一、Register for a Picture Hosting Account

First, visit the official website of the picture hosting service here to register as a member.

二、Generate Token

The Token is required when uploading images. After successful registration and login, click here to generate the Token. First, select a target album, choose the upload method as local upload, and finally click generate. After generating the Token, don't forget to save it, as it will be needed later. tietu_tk

三、Download the Source Code

The code has been hosted on GitHub. You can download it here.

四、Add Token

After downloading the code to your local machine, use a text editor (such as Notepad++) to open it (do not use the default Notepad). Fill in the Token obtained in step two at line 26 of the code, as shown in the screenshot below. add_tk

五、Deploy the Code

Deploy the code to your web server. Finally, you can access and upload images using the URL. For a demonstration, please visit here. tietu

六、Manage Images

Images uploaded through the API can be viewed and managed in the backend of the picture hosting service. Pros: simple and practical code. Cons: If the picture hosting service goes down, the images may also be affected. Additionally, the images are not stored on your own server. Therefore, this method is suitable for temporary picture hosting, while a permanent picture hosting solution is recommended to be developed independently without relying on third-party interfaces.


Comments