mrcnpdlk/image-web-tool

图片网页操作工具

v0.1.1 2018-01-22 15:34 UTC

This package is not auto-updated.

Last update: 2024-09-16 20:57:03 UTC


README

简单的图片网页操作工具包 - 除了所有。

安装

最佳方式是使用特定分支名称克隆仓库。稳定版本发布在此

git clone -b {STABLE_VERSION} https://github.com/mrcnpdlk/image-web-tool.git

配置

在config文件夹中复制文件config.json.dist并将其重命名为config.json。编辑文件并设置或删除选项

  • storage - 图片文件夹的路径
  • font - ttf字体文件的路径。用作占位符文件的字体。
  • debug - 如果为TRUE则不显示占位符,但会显示异常堆栈。

默认字体BlowBrush已包含在项目中。

缓存

为了提高性能,每个请求都会使用缓存。如果启用,则使用REDIS。如果没有启用,则使用FILES。

请求URL模式

示例

http://example.com/iwt/v1/{params}/{fileName}

paramsfileName传递给api.php文件。

请求选项(params

Nginx配置

server {
    listen 127.0.0.1:9081 default_server;

    root API_DIR_LOCATION;

    index api.php;

    server_name _;

    location / {
        try_files $uri $uri/ /api.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_index index.php;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
}
server {
    ## LISTEN
    listen 81;

    ## SERVER
    server_name example.com;

    root ROOT_DIR;
    index index.php index.html index.htm index.nginx-debian.html;

    location /iwt/v1 {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        rewrite ^/iwt/v1/?(.*) /$1 break;

        access_log /var/log/nginx/iwt-access.log;
        error_log /var/log/nginx/iwt-error.log;

        proxy_pass http://127.0.0.1:9081;
        proxy_redirect off;
    }

示例

/h_100/demo.jpg

设置高度。默认启用FIT裁剪模式。

alt text

/h_200,e_b,eo_5/demo.jpg

模糊效果。

alt text

/h_200,e_b,eo_5/demo.jpg

用粉色进行着色效果。

alt text

/h_200,e_n/demo.jpg

负效果。

alt text

/h_200,q_2/demo.jpg

较低的质量。

alt text

/h_200,w_200,c_fill/demo.jpg

FILL模式。

alt text

/h_200,w_200,c_fit/demo.jpg

FIT模式。

alt text

/h_200,w_200,c_fit-margin/demo.jpg

FIT MARGIN模式。

alt text

/h_200,w_200,r_20/demo.jpg

ROTATE模式。

alt text

/w_200,h_100/demo.jpg

文件未找到。显示占位符。

alt text

/w_200,h_100/demo.jpg

显示占位符。

alt text