GithubHelp home page GithubHelp logo

kevin-2106 / random-picture Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yieldray/random-picture

0.0 0.0 0.0 52 KB

随机图片api

Home Page: https://random-picture.vercel.app/

License: GNU General Public License v3.0

JavaScript 21.35% PHP 12.26% TypeScript 21.99% HTML 44.41%

random-picture's Introduction

Random-Picture

通过随机发送 url.csv 文件中给出的图床链接来实现一个随机图片 API
本仓库含 php(vercel), deno(deno.dev) 版本,API 一致
另外给出了 node.js 实现,仅供测试
作为一个简易的 API, 切勿在 url.csv 中添加过多的图片地址

演示

演示图片来自https://www.pixiv.net/users/8236670

php 部署到 Vercel

fork 后,修改自己仓库的 url.csv,然后在 Vercel 平台上导入自己的项目
你也可以直接修改https://github.com/YieldRay/Random-Picture/blob/master/url.csv来创建 fork
Deploy to Vercel

php 部署到虚拟主机

支持 php >= 5.3
直接将下载项目然后上传至虚拟主机即可,此时 API 路径在 ./api 文件夹下
或者下载项目的 ./api/index.php./url.csv ,将这两个文件上传至同一目录即可

deno 部署到 deno.dev

Deno 版本需要你能够托管一个文本文件,文件格式同 ./url.csv
获取这个文本文件的链接。例如:https://raw.githubusercontents.com/YieldRay/Random-Picture/master/url.csv
Deploy to Deno点击此按钮
将链接填入环境变量
deno.png
也可以部署后在此修改环境变量
deno2.png

php 伪静态

伪静态是可选的。
开启伪静态后支持以https://example.net/:id.png形式访问
例如 https://random-picture.vercel.app/1.jpg https://random-picture.vercel.app/2.jpg
Apache 和 Vercel 环境无需配置,默认支持伪静态。
Nginx 参照以下配置:

location / {
        if (!-e $request_filename) {
            rewrite  ^(\w)*\.(?:jpg|jpeg|png|gif|bmp|webp)$  /api/index.php?id=$1  last;
        }
}

random-picture's People

Contributors

yieldray avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.