Giter Site home page Giter Site logo

imageserve's Introduction

图片服务提供

  1. 支持图片的上传、下载
  2. 支持图片base64上传
  3. 支持动态获取图片的压缩图

图片访问接口

生成的图片后缀可以是:.jpg .jpeg .png .webp .gif

图片路径格式(/images/:date/:firstFile/:secondFile/:filename):

  1. data为图片日期yyyyMMdd,firstFile:一级路径,secondFile:二级路径,filename:文件名称
  2. filename组成${filename}-${fileSize}-${width}x${height}.${format},使用 - 分隔不同信息
  3. 原图的路径中不使用下划线 _ ,用来分割附加信息,如 _120x120Q100

缩略图:

按尺寸和质量缩放

  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120.jpg 质量不变,调低尺寸
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100.jpg 质量不变,调低尺寸
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_480x480Q60.jpg 尺寸不变,调低质量

按尺寸和质量缩放并裁剪:

  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120SM.jpg 居中截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120ST.jpg 居上截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120SB.jpg 居下截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120SL.jpg 居左截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120SR.jpg 居右截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100SM.jpg 居中截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100ST.jpg 居上截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100SB.jpg 居下截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100SL.jpg 居左截取
  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_120x120Q100SR.jpg 居右截取

居中截取 尺寸不变,质量降低:

  • /images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_480x480Q60SM.jpg

其他说明

  • 如果原图是水平方向,如全景图,在URL上使用ST、SB将不会起作用,那么截取的图片是居中截取的
  • 如果原图是垂直方向,如长图,在URL上使用SL、SR将不会起作用,那么截取的图片是居中截取的
  • 如果文件路径中包含大小和尺寸信息,后缀添加方式无变化。
  • 图片质量:Q[0-100] 表示图片质量
  • 图片尺寸: 图片尺寸无限制,超过原图尺寸则安装原图尺寸缩放。

图片裁剪:

  • 原图:/images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg
  • 切图:/images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_crop_x_y_w_h.jpg
  • 切图:/images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_crop_200_200_1000_1000.jpg
  • 切图:/images/20180528/31/08/31085a42d3794e86a1cb082e8996ea46-19702-384x240.jpeg_crop_200.1_200.1_1000.4_1000.5.jpg

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.