More Related Content
Similar to カンタン画像サムネイル作成「Smalllight」
Similar to カンタン画像サムネイル作成「Smalllight」 (20)
カンタン画像サムネイル作成「Smalllight」
- 3. Small Light
Small Light(スモールライト)
– to smaller → 小さく
– to lighter → 軽く
Small + Light = Small Light
- 7. Small Light 定義文字列
/small_light(dw=
http://example.com
60,dh=60,...e=imlib2)/http://int
ernal.example.com/images/12345678.jpg
URL中に
– small_light(定義文字列)
- 8. small_light( )
変換前の画像の座標指定:
sx 変換前画像x座標
sy 変換前画像y座標
sw 変換前画像横幅
sh 変換前画像縦幅
変換後の画像の座標指定:
dx 変換後画像x座標
dy 変換後画像y座標
dw 変換後画像横幅
dh 変換後画像縦幅
変換オプション:
da 変換後画像アスペクト比制御種別
(s=短辺基準 l=長辺基準 n=なし 初期値:l)
ds 変換後画像スケーリング制御種別
(s=小さい画像も拡大 n=小さい画像はそのまま 初期値:n)
- 9. small_light( )
キャンバス:
cw キャンバス横幅
ch キャンバス縦幅
cc キャンバス色
ボーダー:
bw ボーダー横幅
bh ボーダー縦幅
bc ボーダー色
出力オプション:
of 出力形式(jpeg,png)
q クォリティー(0~100)
- 10. small_light( )
その他:
info HTTPヘッダーに詳細情報を出力
p パターン名
e 画像変換ライブラリ名
(imlib2,imagemagick,gegl,dummy)
sharpen シャープ
unsharp アンシャープマスク
blur ブラー(ぼかし)
- 11. httpd.conf
RewriteRule ^/small_light[^/]+/(http://.+)$ $1 [P,L]
<LocationMatch ^/small_light[^/]+/>
SetOutputFilter SMALL_LIGHT
</LocationMatch>
</LocationMatch>
RewriteRule ^/resize/(L|M|S)/(.+¥.jpg)$ http://localhost/small_light(p=$1)/http://image.exa
^/resize/(L|M|S)/(.+¥ jpg)$ http://localhost/small_light(p=$1)/http://image.exa
mple.com/$2 [P,L]
mple.com/$2
SmallLightPatternDefine L sx=5p,sy=5p,sw=90p,sh=90p,dw=200,dh=200,da=l,d
sx=5p,sy=5p,sw=90p,sh=90p,dw=200,dh=200,da=l,d
s=s,cw=200,ch=200,cc=ffffff,q=80,of=jpg
=s,cw=200,ch=200,cc=ffffff,q=80,of=jpg
SmallLightPatternDefine M sx=5p,sy=5p,sw=90p,sh=90p,dw=100,dh=100,da=l,
sx=5p,sy=5p,sw=90p,sh=90p,dw=100,dh=100,da=l,
ds=s,cw=100,ch=100,cc=ffffff,q=70,of=jpg
ds=s,cw=100,ch=100,cc=ffffff,q=70,of=jpg
SmallLightPatternDefine S sx=5p,sy=5p,sw=90p,sh=90p,dw=50,dh=50,da=l,ds
sx=5p,sy=5p,sw=90p,sh=90p,dw=50,dh=50,da=l,ds
=s,cw=50,ch=50,cc=ffffff,q=60,of=jpg
=s,cw=50,ch=50,cc=ffffff,q=60,of=jpg
# /resize/L/ → small_light(p=L)
small_light(p=L)
# /resize/M/ → small_light(p=M)
small_light(p=M)
# /resize/S/ → small_light(p=S)
small_light(p=S)
- 20. nginx + squid
nginx
– ngx_http_upstream_consistent_hash
– failover
squid
- 21. サーバー構成
サービスA
サービスA サービスB
サービスB サービスC
サービスC
load balancer
load balancer
nginx
nginx nginx
nginx nginx
nginx nginx
nginx
squid
squid squid
squid squid
squid squid
squid
apache
apache apache
apache apache
apache apache
apache
(mod_small_light)
(mod_small_light) (mod_small_light)
(mod_small_light) (mod_small_light)
(mod_small_light) (mod_small_light)
(mod_small_light)
STF / image storage
STF / image storage
- 23. nginx + squid
nginx + squidの詳細について
– [ hideden + nginx ] というキーワードで、
Googleでググったり、
NAVERでネバったりしてみてください。