假设http://static.yumcircle.com/1.jpg这个是源图片
那么在调用缩略图时,使用http://static.yumcircle.com/1!200×100.jpg 就会生成一张200宽100高的图片 !200×100就是具体的参数
ok,下面说一下我定义的参数:
1.固定尺寸缩放(这个参数会将源图强制缩放到这个尺寸,所以可能会有所变形)
- !200×100 将源图缩放为宽200x高100
- !200 将源图缩放为宽200x高200
- !200×100-50 将源图缩放为宽200x高100 并且图片质量为50 (这个是为了给手机端使用的,因为手机端可能需要图片的size更小一些)
- !200-50 将源图缩放为宽200x高200 并且图片质量为50
2.等比缩放
- :w200 将源图宽缩放为200,高度=原图宽高比自适应,(意思是,强制将源图的宽缩到200,高按原图比例缩放)
- :h200 将源图高缩放为200,宽自适应
- :m200 将源图以(宽,高那个值大,以哪个为准,进行缩放,比如源图是300×400,那就会以高为准,先将高缩到200),但是如果宽高都没有达到,而不处理
同时也支持 :w200-50 :h200-50 :m200-50 的图片质量
3.中心剪辑
- @200×300 将源图以(宽,高那个值小,以哪个为准,进行缩放,并在缩放后的图片,以另一边中间点(就是正中间,进行剪辑)
- @200×300-50 同时支持图片质量
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
| location ~ (.*)!(\d+)x(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public;
set $bucketname static; set $srcPath /data0/www/yumCircle/public; set $destPath /data0/www/yumCircle/public;
set $type 1;
if (!-f $request_filename){ rewrite_by_lua_file conf/image_resize_thumb.lua; } }
location ~ (.*)!(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 3;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
location ~ (.*)!(\d+)-(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 4;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
location ~ (.*):(w|h|m)(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 5;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
location ~ (.*):(w|h|m)(\d+)-(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 6;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
location ~ (.*)\@(\d+)x(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 7;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
location ~ (.*)\@(\d+)x(\d+)-(\d+).(gif|jpg|jpeg|png)$ { root /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $bucketname static; set $srcPath /data0/www/yumCircle/public/images/uploaded/origin; set $destPath /data0/www/yumCircle/public/images/uploaded/thumbnails;
set $type 8;
if (!-f $request_filename) { rewrite_by_lua_file /data0/www/yumCircle/image_resize_thumb.lua; } }
|