Line Bot 發送圖片需要有各種解析度的 URL
但若要產生各種解析度的圖片會耗費太多時間造成 Timeout
所以直接寫 Rewrite 到最高解析度的圖片 URL 就好
寫在 Virtual Host 段
如果有多個不同路徑都會用到相同功能可以寫多個 Directory
<VirtualHost *:80>
<Directory "${SITEROOT}/www.contoso.com/image">
<IfModule rewrite_module>
RewriteEngine On
RewriteRule ^(.*)/300 /image/$1 [L]
RewriteRule ^(.*)/460 /image/$1 [L]
RewriteRule ^(.*)/700 /image/$1 [L]
RewriteRule ^(.*)/1040 /image/$1 [L]
</IfModule>
</Directory>
<Directory "${SITEROOT}/www.contoso.com/picture">
<IfModule rewrite_module>
RewriteEngine On
RewriteRule ^(.*)/240 /picture/$1 [L]
RewriteRule ^(.*)/300 /picture/$1 [L]
RewriteRule ^(.*)/460 /picture/$1 [L]
RewriteRule ^(.*)/700 /picture/$1 [L]
RewriteRule ^(.*)/1040 /picture/$1 [L]
</IfModule>
</Directory>
</VirtualHost>
沒有留言:
張貼留言