Giter VIP home page Giter VIP logo

rampic's Introduction

Random-Picture

随机图片 api

实验地址:

https://illyasviel.feedia.co/ (无稳定性保证)
https://random-picture.vercel.app/ (部署到 vercel)

注意:

路径 说明
./url.csv 务必一行一个 url,不要输入不完整的 url
./api/index.php ALLOW_OUTPUT 是否允许服务器输出;ERROR_IMG 出错时的图片

部署到 Vercel

建议 fork 后,自行修改配置,然后在 Vercel 平台上导入自己的项目
Deploy with Vercel

关于 Rewrite

伪静态是可选的。
开启伪静态后,将支持以https://example.net/:id.png形式访问
:id 即图片 id,如果非数字,则随机跳转。请求会被缓存。
Apache 和 Vercel 部署都直接支持伪静态。
Nginx 参照以下配置:

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

Doc

直接调用

访问./api即可,跳转至图片地址

访问./api/?id=数字,跳转至指定图片

注:api附加参数 api=数字 亦可跳转至指定图片

如:./api/?type=json&id=3

访问./api/?type=length

返回图片总量,即id的最大值

访问./api/?type=output

服务器读取后输出,一般不建议使用,默认禁用

访问./api/?type=json

服务器输出json

         
{"code":"200","url":"https:\/\/fp1.fghrsh.net\/2019\/07\/15\/c2549aaa63db078834ead6a92fe63b61.jpg"}
    

访问./api/?type=JSON

服务器读取图片信息后输出json,如非需要图片信息不建议使用

         
{"code":"200","url":"https:\/\/fp1.fghrsh.net\/2019\/07\/15\/c2549aaa63db078834ead6a92fe63b61.jpg","width":"1920","height":"1080","mime":"image\/jpeg","size":"821735"}
    

rampic's People

Contributors

yyqyu avatar

Watchers

 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.