In the early years, when there was no concept of "image hosting," images were attached to blog posts as attachments, and my choice was to "try not to post anything with images"...
Slowly, it became a habit... Later, when I occasionally needed to post images, I would upload them to public image hosting services like sm.ms
;
Using GitHub Actions + Markdown to update Z-Blog:
wdssmq/Markdown-To-Z-Blog
Images and .md files are placed together, and I use VSCode + Markdown All in One plugin for daily editing, and then use Typora + PicGo to upload and import images;
Not to mention that Typora is now charging, the biggest problem is that it does not support paths with #
when uploading images...
In the previous article "The Thing About Automatically Tracking Materials on a Full Map in Genshin Impact", it was also mentioned that although jsDelivr is now back in use, there is always some concern as an image hosting service... // Although I have used it as a CDN in various places...
In short, I have now decided to study the Cloudflare Workers solution for using GitHub as a CDN;
Using Cloudflare Workers to reverse proxy the image hosting set up with GitHub repository - Senjianlu's Blog:
The image addresses correspond to:
https://raw.githubusercontent.com/wdssmq/Markdown-To-Z-Blog/main/doc/001.orig.png
https://img.wdssmq.workers.dev/doc/001.orig.png
For the actual configuration steps, see: "Troubleshooting Cloudflare Worker Reverse Proxy for RSSHub"
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
// Cloudflare Workers domain
// const cf_worker_host = "img.wdssmq.workers.dev";
// Also bind your own domain
const cf_worker_host = new RegExp("img.wdssmq.workers.dev|img.wdssmq.com","g");
// GitHub repository file address
const github_host = "raw.githubusercontent.com/wdssmq/Markdown-To-Z-Blog/main";
// Replace
const url = request.url.replace(cf_worker_host, github_host);
return fetch(url);
}
2022-06-17:
Finally, I have also achieved the ability to directly write relative addresses in the markdown file and automatically replace them when publishing;
wdssmq/Markdown-To-Z-Blog: Using GitHub Actions + Markdown to update Z-Blog. #md2zb:
https://github.com/wdssmq/Markdown-To-Z-Blog# 图床
Using GitHub Actions + Markdown to update Z-Blog - Computer Networking - 沉冰浮水: