定制 mrcnpdlk/image-web-tool 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrcnpdlk/image-web-tool

Composer 安装命令:

composer create-project mrcnpdlk/image-web-tool

包简介

Image Web Manipulator

README 文档

README

Simple image web tool manipulation package - other than all.

Instalation

The best way is cloning the repo with specific branch name. Stable releases are sown here.

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

Configuration

In folder config copy file config.json.dist and rename to config.json. Edit file and set or delete options:

  • storage - path to the folder with pictures
  • font - path to the ttf file with font. Used as font on placeholders files.
  • debug - if TRUE no placeholder, but exception stack is shown.

Default font BlowBrush is included to the project.

Caching

For better performance for each request cache is used. REDIS if enabled. If not FILES is used.

Request url schema

Example

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

params and fileName are passed to the api.php file.

Request Options (params)

Option Description Values Notes
w width value in px
h height value in px
c crop mode enum: scale,fit,fit-margin,fill
q quality 0-100 only JPG format supported
r rotate angle in degrees
bgc background color HEX format
e effect enum: g (gamma), n (negative), gr (grayscale), c (colorize), b (blur)
eo effect option string,int - depends on effect type, see table below
Effect [e] Description Option [eo] Default
g gamma gamma correcion 1
n negative
gr grayscale
c colorize color in HEX format #FFFFFF
b blur sigma 1

Nginx Configuration

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;
    }

Examples

/h_100/demo.jpg

Height is set. Default FIT crop mode is enabled.

alt text

/h_200,e_b,eo_5/demo.jpg

Blur effect.

alt text

/h_200,e_b,eo_5/demo.jpg

Colorization effect with pink color.

alt text

/h_200,e_n/demo.jpg

Negative effect.

alt text

/h_200,q_2/demo.jpg

Less quality.

alt text

/h_200,w_200,c_fill/demo.jpg

FILL mode.

alt text

/h_200,w_200,c_fit/demo.jpg

FIT mode.

alt text

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

FIT MARGIN mode.

alt text

/h_200,w_200,r_20/demo.jpg

ROTATE mode.

alt text

/w_200,h_100/demo.jpg

File not found. Placeholder is shown.

alt text

/w_200,h_100/demo.jpg

Placeholder is shown.

alt text

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固