Although photos and file storage can now be uploaded to network disks, domestic network disks are still a little different from foreign network disk storage. Take the comparison between Baidu Netdisk and Dropbox as an example. Baidu Netdisk is at best a network hard drive used by individuals to store private photos and files. If it is used for sharing, it can easily be restricted or canceled by Baidu for downloading.
Many personal webmasters choose to build their own storage and download centers for the convenience of sharing. For example, the personal download center ucblog.net built by Dizhanbo is built using the Directory Lister program. As long as there is a PHP environment and no database is needed, Directory Lister can be run. , this procedure is simple but moving is particularly simple, just pack it up and upload it.
Directory Lister was developed by foreigners, so it naturally has many compatibility issues with Chinese. This article will share two out-of-the-box, easy-to-use photo album programs ImgURL and online file manager directory listing program Zdir, developed and maintained by my friend xiaoz.me, which are very suitable for individuals. The webmaster uses it as a picture bed, photo album and file download and sharing.
For those that are not mainly used for sharing but for storage, we can use VPS hosts to build cloud storage services. Related tutorials include:
- DigitalOcean Spaces cloud storage space management - can be used for synchronous backup, mounting and expansion
- Plex Perfect Personal Video Cloud Disk Building Tutorial-Plex Media Server Installation and Usage Methods
- Use Pydio to build free private cloud storage-multi-terminal automatic synchronization can play music videos online
PS: Updated on August 21, 2018, Microsoft’s OneDrive network hard drive has always been known for its large capacity and stability. Many people use OneDrive as a network storage tool. Here is a way to build OneDrive as an external link. How to use a network disk: OneDrive turns into an external network disk - Aria2+Aria2Ng+OneIndex automatically uploads to OneDrive.
1. Image bed album program: ImgURL
- Project address: https://github.com/helloxz/imgurl
- Demo address: https://imgurl.org/
1.1 ImgURL introduction
ImgURL is a simple and pure image hosting program developed using PHP + SQLite 3. It does not require complex configuration and can be used out of the box.
Environmental requirements
PHP >= 5.6
Requires exif function support
SQLite 3
Functions and features
Drag and drop to upload, automatically generate connections, and copy with one click.
Image preview and exploration
Basic image management
Support TinyPNG image compression
Development Plan
Image upload and preview
Generate links with one click
Browse and delete pictures
Limit the number of guest uploads
Image Compression
Picture yellow detection
Picture watermark
API upload
1.2. Installation and use
installation steps:
- Visit: master.zip Download the latest version of the ImgURL program, put it in the root directory of your site and unzip it.
- Visit
http(s)://domain.com/check.php
to obtain the configuration information and record it. - Modify
config.php
to set your own domain name and password, and visithttp(s)://domain.com/
. It’s that simple.
Security Settings
After the configuration is completed, there is no problem with the test function. Please delete
check.php
in the root directory.Apache has blocked database downloads by default through the
.htaccess
fileNginx users please add the following configuration in the server section and restart Nginx
location ~* .(db3)$ {
deny all;
}
After clicking ImgURL to upload the image, the link address will be displayed. The image storage interface will look like the following (click to enlarge):
ImgURL also provides the function of managing images in the background, allowing you to quickly view uploaded images.
1.3. Image compression and upload size adjustment
Enable TinyPNG compressed images. Visit https://tinypng.com/ official website to register an account and obtain your own API KEY. TinyPNG provides an excellent image compression service and provides API support. Ordinary users have a limit of 500 times/month, but ImgURL can fill in multiple TinyPNG KEYs, allowing the API times to be superimposed to compress more images.
Open config.php
, fill in your own TinyPNG API key and save it. (Supports asynchronous compression of images, does not affect upload speed), the configuration file example is as follows:
// TinyPNG压缩图片
$tinypng = array(
"option" => true,
"key" => array(
"xxx", //支持填写多行key
"xxx" //如果只有一个key,请删除此行,注意最后一行没有逗号(,)
)
);
Modify the upload size. ImgURL photo album program has a default limit of 2M upload size. You can modify the limit through the following methods. Open /functions/upload.php
and find the following code:
$handle->file_max_size = '2097152';
The unit is bytes, you can modify it yourself. In order to ensure upload stability, it is not recommended to exceed 10M. Continue to open static/embed.js
and find the following line to modify.
,size: 2048
2. Directory listing program: Zdir
- Project: https://github.com/helloxz/zdir
- Demo: http://soft.xiaoz.org/
Zdir is a directory listing program developed using PHP. It supports Markdown file preview and can delete files online. Add ?admin
or &admin
parameters to the page you visit, and the file will be A delete button appears and the file can be deleted.
2.1 Installation and use
Instructions
Download the source code and put it in the root directory of the site
Modify
config.php
to set your own website title/keywords/descriptionIf you need to exclude a directory, modify
config.php
again, there are instructions in itFor more instructions, please view the help documentation: https://doc.xiaoz.me/docs/zdir
The main function
Directory browsing
MarkDown file preview
CSS/JavaScript one-click copy
file hash
Picture Preview
File index
QR code generation
File deletion
Note: Do not use Chinese to name directories/files, otherwise unpredictable errors may occur. The program interface is as shown below (click to enlarge):
2.2 Function detailed description
MarkDown file preview. If it is a MarkDown file (.md), a small eye button will appear behind it. Click this button to preview directly. If the file is named after readme.md, the "Instructions for Use" button will appear. Click it to preview it, as shown in the screenshot below.
Link copy. The copy button will judge based on the file type and finally return different copy results, which is very helpful when building a front-end library, such as:
<!–If the .js file is copied, the returned result is –>
<script src = 'https://libs.xiaoz.top/jquery/2.0.3/jquery-2.0.3.js'>< /script>
<!–If the .css file is copied, the return result is –>
<link rel='stylesheet' href='https://libs.xiaoz.top/layer/skin/layer .css'>
<!–If it is a file such as an image–>
<img src = 'https://libs.xiaoz.top/material/loading/loading0.gif' />
Other files Returns the file URL address.
View file hash. Click the "exclamation mark" button behind the file to calculate the md5 and sha1 values of the file, verify the file hash value, and avoid risks such as operator hijacking.
Image preview. Moving the mouse over the image file will display a preview of the image, as shown in the screenshot below.
File index. If there are too many files, it is inconvenient to search. Zdir has not yet implemented the file search function. However, through the "File Index" function and "Ctrl + F", finding files can be done in minutes. The "File Index" cache time is 24 hours. If you want to clear the cache immediately, please visit cache.php?del=cache
.
3. Summary
ImgURL is particularly suitable for image sharing. Both administrators and visitors can directly upload images and share links. It should be pointed out that ImgURL can also set up image pornography detection, image compression, etc. In this case, you need to apply for the API in advance before it can be used normally.
Zdir is somewhat similar to Directory Lister. It only needs PHP to run. The function is simple but very practical, and it is easy to get started. If you want more online file managers, you can check out: Comparison of three excellent online file managers (directory list).