A Good Solution for Blog Images

Erhua Li / 2023-09-23


Keywords: blog, image solution, image hosting, ffmpeg, alt

Today while writing the article “Wangjing and Wangjing Park”, I was thinking again about how I should handle the image issue. I have talked many times before about how the articles and images for my blog are stored in a private GitLab repository. The reason the original images are also stored in the private repository is that I don’t want to experience another image hosting migration like I did with my archived blog from before.

However, with the increasing number of images stored in the private repository, I have to face a problem - the size of the repository will become very large (code repositories aren’t meant for file storage in the first place, specialized tools should be used for specialized tasks). I have also tried various combination of solutions before to reduce the storage footprint of the images, which helps resolve some of the issues, but then new problems arise, such as where I should manage the higher quality original images after compression. I don’t want to discard them but keeping them takes up a lot of space.

Before writing this document, my entire image workflow was as follows:

iPhone Shortcut

This process is very similar to a manufacturing process for a part, where there can be multiple techniques to make the same part, but a better, more sensible technique will minimize the material and time costs to produce the part, maximizing the profit margin of the company. Similarly for personal life, everyone’s time is limited, and optimizing solutions to problems to reduce the processing time (even better if it also reduces monetary costs) will free up more time for rest or creating other value.

Looking now, there are still many areas this workflow can be improved:

Based on these potential workflow improvements, we can completely implement the previously laborious and manual steps in one script.

After scripting the process, our complete workflow becomes:

The script needs to:

This reduces a previously hour-long task to minutes.