https://github.com/qinmingyuan/upyun_rails
https://github.com/qinmingyuan/upyun_rails
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/qinmingyuan/upyun_rails
- Owner: qinmingyuan
- License: mit
- Created: 2020-07-26T06:28:36.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T14:27:47.000Z (9 months ago)
- Last Synced: 2024-08-24T15:39:02.150Z (9 months ago)
- Language: Ruby
- Size: 43 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# ActivestorageUpyun
Upyun service for activestorage.## Installation
Add this line to your application's Gemfile:```ruby
gem 'activestorage_upyun', require: false
```Set up upyun storage service in config/storage.yml:
```yml
upyun:
service: Upyun
bucket: <%= ENV['UPYUN_BUCKET'] %>
operator: <%= ENV['UPYUN_OPERATOR'] %>
password: <%= ENV['UPYUN_PASSWORD'] %>
host: <%= ENV['UPYUN_HOST'] %>
folder: <%= ENV['UPYUN_FOLDER'] %>
```Set up activestorage service:
```ruby
config.active_storage.service = :upyun
```Use for image url
```erb
<%= image_tag @user.avatar.service_url %>
```Or add thumb version named `webpw200`
```erb
<%= image_tag @user.avatar.service_url(params: {process: 'webpw200'}) %>
```thumb version use `!` as default identifier, if you want to use `_` as identifier, you can add `identifier` option
```yml
upyun:
service: Upyun
bucket: <%= ENV['UPYUN_BUCKET'] %>
operator: <%= ENV['UPYUN_OPERATOR'] %>
password: <%= ENV['UPYUN_PASSWORD'] %>
host: <%= ENV['UPYUN_HOST'] %>
folder: <%= ENV['UPYUN_FOLDER'] %>
identifier: _
```## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).