After trying many image hosting services, the best one is still Lankong, just as described on their official website:
Build your own cloud photo album, simple and practical.
Preparation
Before deploying Lankong Image Bed to the server, some checks need to be done.
According to the official documentation, first, make sure that the PHP
version of the server is ≥ 8.0.2, and then check if all the required PHP extensions are installed and if some functions are disabled.
The required PHP
extensions and functions for Lankong Image Bed include:
- BCMath PHP extension
- Ctype PHP extension
- DOM PHP extension
- Fileinfo PHP extension
- JSON PHP extension
- Mbstring PHP extension
- OpenSSL PHP extension
- PDO PHP extension
- Tokenizer PHP extension
- XML PHP extension
- Imagick extension
- exec, shell_exec functions
- readlink, symlink functions
- putenv, getenv functions
For the database
, you can choose:
- Mysql 5.7+
- PostgreSQL 9.6+
- SQLite 3.8.8+
- SQL Server 2017+
Create Website
- In the Baota panel, create a new website.
- Upload and unzip the downloaded version from GitHub to the website's files (you can also choose to download remotely - download from URL).
- Change the permissions, user group, and owner of all folders, subfolders, and files in the program directory to
www
, and the permissions to0755
.
- Set the running directory of the website to the
public
folder of the program.
-
Set up rewrite rules.
location / { try_files $uri $uri/ /index.php?$query_string; }
- Enter the website address you created in the browser to complete the installation.
Image Bed Configuration
After the installation is complete, enter the email and password you set in step 6 above to log in to the management interface.
I recommend turning off registration and guest uploads in the System Settings
to avoid misuse of your image bed and negative impact.
In the Storage Strategy
, you can set the location for image storage. Lankong Image Bed supports ten storage locations, including local storage, AWS S3, Alibaba Cloud OSS, Tencent Cloud COS, Qiniu Cloud Kodo, Upyun USS, SFTP, FTP, WebDAV, and Minio.
As shown in the figure, I added Tencent Cloud Object Storage as the default storage location for images.
uPic Configuration
uPic is a macOS image hosting tool that allows us to quickly upload images to the image bed. To configure Lankong Image Bed in uPic, you need to obtain the token for Lankong Image Bed.
You can use the curl
command in the server's SSH to get it.
curl -X POST -F "email=your_email@address" -F "password=your_passwd" https://your.domain/api/v1/tokens
Then go to the preferences of uPic and select Custom for the image bed.
- API URL is
your.domain/api/v1/upload
- Request method is POST
- File field name is
file
- URL path is
["data", "links", "url"]
- Save path is
{year}/{month}/{day}/{filename}{suffix}
Then click on other fields to add the Header field.
- Content-Type: multipart/form-data
- Accept: application/json
- Authorization: Bearer + token, for example,
Bearer 1|2zxF05em0J2UcFxxxxxxxxxxxxxx
After completing all the configurations, click Verify. At this time, an image will appear on the image bed, indicating that the configuration is successful.