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.
First, visit the official website of the picture hosting service here to register as a member.
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.
The code has been hosted on GitHub. You can download it here.
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.
Deploy the code to your web server. Finally, you can access and upload images using the URL. For a demonstration, please visit here.
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.
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.