Nginx Image Module图片缩略图 水印处理模块
Nginx Image Module图片缩略图 水印处理模块
下载Tengine
tar -zxvf tengine-1.4.5.tar.gz
cd tengine-1.4.5
下载Nginx
tar -zxvf nginx-1.4.0.tar.gz
cd nginx-1.4.0
wget https://github.com/3078825/nginx-image/archive/master.zip
unzip master.zip
./configure --add-module=/opt/software/nginx-image-master
make
make install
配置方法
打开 nginx.conf
在
location / {
#添加以下配置
image on;
image_output on;
}
或者指定目录开启
location /upload {
image on;
image_output on;
}
其他参数说明:
image on/off 是否开启缩略图功能,默认关闭
image_backend on/off 是否开启镜像服务,当开启该功能时,请求目录不存在的图片(判断原图),将自动从镜像服务器地址下载原图
image_backend_server 镜像服务器地址
image_output on/off 是否不生成图片而直接处理后输出 默认off
image_jpeg_quality 75 生成JPEG图片的质量 默认值75
image_water on/off 是否开启水印功能
image_water_type 0/1 水印类型 0:图片水印 1:文字水印
image_water_min 300 300 图片宽度 300 高度 300 的情况才添加水印
image_water_pos 0-9 水印位置 默认值9 0为随机位置,1为顶端居左,2为顶端居中,3为顶端居右,4为中部居左,5为中部居中,6为中部居右,7为底端居左,8为底端居中,9为底端居右
image_water_file 水印文件(jpg/png/gif),绝对路径或者相对路径的水印图片
image_water_transparent 水印透明度,默认20
image_water_text 水印文字 "Power By Vampire"
image_water_font_size 水印大小 默认 5
image_water_font 文字水印字体文件路径
image_water_color 水印文字颜色,默认 #000000
调用说明
这里假设你的nginx 访问地址为 http://127.0.0.1/
并在nginx网站根目录存在一个 test.jpg 的图片
通过访问
http://127.0.0.1/test.jpg!c300x200.jpg 将会 生成/输出 test.jpg 300x200 的缩略图
其中 c 是生成图片缩略图的参数, 300 是生成缩略图的 宽度 200 是生成缩略图的 高度
一共可以生成四种不同类型的缩略图。
支持 jpeg / png / gif (Gif生成后变成静态图片)
C 参数按请求宽高比例从图片高度 10% 处开始截取图片,然后缩放/放大到指定尺寸( 图片缩略图大小等于请求的宽高 )
M 参数按请求宽高比例居中截图图片,然后缩放/放大到指定尺寸( 图片缩略图大小等于请求的宽高 )
T 参数按请求宽高比例按比例缩放/放大到指定尺寸( 图片缩略图大小可能小于请求的宽高 )
W 参数按请求宽高比例缩放/放大到指定尺寸,空白处填充白色背景颜色( 图片缩略图大小等于请求的宽高 )
调用举例
http://127.0.0.1/test.jpg!c300x300.jpg
http://127.0.0.1/test.jpg!t300x300.jpg
http://127.0.0.1/test.jpg!m300x300.jpg
http://127.0.0.1/test.jpg!w300x300.jpg
http://127.0.0.1/test.c300x300.jpg
http://127.0.0.1/test.t300x300.jpg
http://127.0.0.1/test.m300x300.jpg
http://127.0.0.1/test.w300x300.jpg
Nginx Image Module图片缩略图 水印处理模块的更多相关文章
- [转帖]Nginx Image Module图片缩略图 水印处理模块
Nginx Image Module图片缩略图 水印处理模块 https://www.cnblogs.com/jicki/p/5546972.html Nginx Image Module图片缩略图 ...
- C# 生成图片验证码 图片缩略图 水印
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D ...
- Nginx/Apache图片缩略图技术
1,目的 2,使用方式 3,Nginx + Linux 缩略图实现 3.1,原理 3.2,nginx配置实现 3.3,例子 4,Apache + Windows缩略图实现 4.1,环境 4.2,原理 ...
- nginx实现本地图片生成缩略图
nginx可以实现图片的缩略图效果,很多网站为了前端静态资源相应的性能会给大图自动生成一个小图,比如我们经常会在网上看到bd_64x64.png这种格式,淘宝上的小图经常会看到xxx.jpg_100x ...
- PHPThumb处理图片,生成缩略图,图片尺寸调整,图片截取,图片加水印,图片旋转
[强烈推荐]下载地址(github.com/masterexploder/PHPThumb). 注意这个类库有一个重名的叫phpThumb,只是大小写的差别,所以查找文档的时候千万注意. 在网站建设过 ...
- nginx上传模块—nginx upload module-
一. nginx upload module原理 官方文档: http://www.grid.net.ru/nginx/upload.en.html Nginx upload module通过ngin ...
- Nginx Upload Module 上传模块
传统站点在处理文件上传请求时,普遍使用后端编程语言处理,如:Java.PHP.Python.Ruby等.今天给大家介绍Nginx的一个模块,Upload Module上传模块,此模块的原理是先把用户上 ...
- GD库 图片缩略图 图片水印
/** * GD库 图片缩略图 *//*$image = imagecreatefromjpeg("1.jpg");var_dump($image);exit;$width = i ...
- 使用 ImageEnView 给图片加水印,及建缩略图
摘要: 使用 ImageEnView 给图片加水印,及建缩略图 {Power by hzqghost@21cn.com}unit CutWater; interface uses Math,imag ...
随机推荐
- select用法
每一次操作select的时候,总是要出来翻一下资料,不如自己总结一下,以后就翻这里了. 比如<select class="selector"></select&g ...
- POJ 2975 Nim 尼姆博弈
题目大意:尼姆博弈,求先手必胜的情况数 题目思路:判断 ans=(a[1]^a[2]--^a[n]),求ans^a[i] < a[i]的个数. #include<iostream> ...
- zepto.js 学习之(一)
中文文档:http://mweb.baidu.com/zeptoapi/#attr
- 每个程序员都应该学习使用Python或Ruby
每个程序员都应该学习使用Python或Ruby 如果你是个学生,你应该会C,C++和Java.还会一些VB,或C#/.NET.多少你还可能开发过一些Web网页,你知道一些HTML,CSS和JavaSc ...
- Windows API 之 CreateThread、GetExitCodeThread(未完)
GetExitCode Retrieves the termination status of the specified thread. BOOL WINAPI GetExitCodeThread( ...
- 移动WEB开发资源
很多移动开发的资源 http://www.cnblogs.com/PeunZhang/p/3407453.html
- js 常用正则表达式表单验证代码
正则表达式使用详解 简介 简单的说,正则表达式是一种可以用于模式匹配和替换的强有力的工具.其作用如下:测试字符串的某个模式.例如,可以对一个输入字符串进行测试,看在该字符串是否存在一个电话号码模式或一 ...
- Android系统权限及签名
Android系统权限及签名 2015-03-23 19:13:33CSDN-chen52671-点击数:50 Android权限及签名 引子 现象:系统中的一个定制Service,服务是 ...
- Binary Watch
Binary Watch 描述 Consider a binary watch with 5 binary digits to display hours (00 - 23) and 6 binary ...
- android脚步---Itent.ACTION_PICK ,startActivityForResult
public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(Intent.A ...