diff options
author | Jason Lee <huacnlee@gmail.com> | 2018-02-01 23:49:25 +0800 |
---|---|---|
committer | Jason Lee <huacnlee@gmail.com> | 2018-02-01 23:49:25 +0800 |
commit | 69ae9fe6b508acdf5bdfc64c5baae70bce15fad6 (patch) | |
tree | bfa0e3f929b0a22cfeb1f748d4d7a37d0a74e9d9 /activestorage/app/jobs | |
parent | 4f0eb1ccd9652118b05d42f152adaa4df7dc3388 (diff) | |
download | rails-69ae9fe6b508acdf5bdfc64c5baae70bce15fad6.tar.gz rails-69ae9fe6b508acdf5bdfc64c5baae70bce15fad6.tar.bz2 rails-69ae9fe6b508acdf5bdfc64c5baae70bce15fad6.zip |
Allow `ActiveStorage::Blob#service_url` to pass addition options to `service.url`.
Because there have some service needs more parameters for file URL:
https://www.alibabacloud.com/help/doc-detail/44687.htm
```rb
class AliyunService < Service
def url(key, options = {})
image_process = options[:oss_process] || "image/resize,w_800"
"http://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=#{image_process}"
end
end
```
Use case:
```erb
<%= image_tag @user.avatar.service_url(oss_process: "image/resize,m_fill,h_100,w_100" %>
```
Diffstat (limited to 'activestorage/app/jobs')
0 files changed, 0 insertions, 0 deletions