Skip to content

基于Docker的随机图API - Docker-based random image API

License

Notifications You must be signed in to change notification settings

huangwb8/random-image

Repository files navigation

Random Image API

概述

对教程《Docker系列 WordPress系列 自建随机图API之静态壁纸 - Bensz》中的个人博客随机图API进行Docker化,使其布署更加方便。特性:

  • 基于PHP
  • 依据访问设备类型(PC/iPad vs. Mobile)选择不同壁纸

msedge_Lob04vv27a

用法

  • 克隆本仓库
git clone https://github.com/huangwb8/random-image.git
  • 新建镜像random-image
docker build -t random-image .
  • 自定义img.txtimg_mobile.txt
    • img.txt是PC端壁纸的URL集合,img_mobile.txt是手机端壁纸的URL集合
    • 通过在URL前面添加#可沉默该URL,即不进入随机选择
  • 通过docker-compose布署
docker-compose up -d
  • 假设用https://randomimage.hwb0307.com反代了该容器的局域网http://ip:1000,将链接https://randomimage.hwb0307.com添加到个人博客的背景图片中即可。以WordPress主题Argon为例,添加位置如下:

image-20240528201658420

注意

  • 普通用户可按需修改img.txtimg_mobile.txtdocker-compose.yml
  • 高级用户可按需修改index.php

About

基于Docker的随机图API - Docker-based random image API

Resources

License

Stars

Watchers

Forks

Packages

No packages published