All Projects → huacnlee → Activestorage Aliyun

huacnlee / Activestorage Aliyun

Licence: mit
Wraps the Aliyun OSS as an Active Storage service.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Activestorage Aliyun

Stratify
Rails + MongoDB app for building a consolidated timeline of your data from disparate sources (e.g., Twitter, GitHub, Foursquare, etc.)
Stars: ✭ 97 (-5.83%)
Mutual labels:  rails
Kube Aliyun
Aliyun Essentials for Kubernetes (SLB, Routes and Volumes)
Stars: ✭ 100 (-2.91%)
Mutual labels:  aliyun
Simple recommender
A simple recommendation engine for Rails/Postgres
Stars: ✭ 101 (-1.94%)
Mutual labels:  rails
Comfy Blog
Blog Engine for ComfortableMexicanSofa (Rails 5.2+)
Stars: ✭ 98 (-4.85%)
Mutual labels:  rails
Simpacker
Use modern JavaScript build system in Rails.
Stars: ✭ 100 (-2.91%)
Mutual labels:  rails
Material design lite Sass
Google's Material Design Lite with Material Icons and Roboto font for Ruby applications
Stars: ✭ 100 (-2.91%)
Mutual labels:  rails
Active record replica
Redirect ActiveRecord (Rails) reads to replica databases while ensuring all writes go to the primary database.
Stars: ✭ 96 (-6.8%)
Mutual labels:  rails
Premailer Rails
CSS styled emails without the hassle.
Stars: ✭ 1,382 (+1241.75%)
Mutual labels:  rails
Instagram api gem
A Ruby wrapper for the Instagram API
Stars: ✭ 100 (-2.91%)
Mutual labels:  rails
Activerecord Clean Db Structure
Automatic cleanup for the Rails db/structure.sql file (ActiveRecord/PostgreSQL)
Stars: ✭ 101 (-1.94%)
Mutual labels:  rails
Yabeda Rails
Yabeda plugin to collect basic metrics for Rails applications
Stars: ✭ 99 (-3.88%)
Mutual labels:  rails
Splits Io
a speedrunning data store, analysis engine, and racing platform
Stars: ✭ 99 (-3.88%)
Mutual labels:  rails
Graphql devise
GraphQL interface on top devise_token_auth
Stars: ✭ 100 (-2.91%)
Mutual labels:  rails
Sr mini
A single file Rails app that will have you running a StimulusReflex and CableReady demo in just 2 steps.
Stars: ✭ 98 (-4.85%)
Mutual labels:  rails
Pong
Two player Pong reinvented using Vue.js and Rails w/ Action Cable
Stars: ✭ 101 (-1.94%)
Mutual labels:  rails
Rails Guides
Rails Guides 中文版
Stars: ✭ 97 (-5.83%)
Mutual labels:  rails
Test track
Server app for the TestTrack multi-platform split-testing and feature-gating system
Stars: ✭ 100 (-2.91%)
Mutual labels:  rails
Coding further
"Coding further" is made for my students who graduated from Le Wagon coding bootcamp and are just now exploring the world of programming.
Stars: ✭ 103 (+0%)
Mutual labels:  rails
React Activestorage Provider
A React component that allows easy file upload using ActiveStorage
Stars: ✭ 102 (-0.97%)
Mutual labels:  rails
Yunqi Iot Demo
阿里云IoT物联网套件开发实战
Stars: ✭ 101 (-1.94%)
Mutual labels:  aliyun

ActiveStorage Aliyun Service

Wraps the Aliyun OSS as an Active Storage service, use Aliyun official Ruby SDK for upload.

Gem Version build

Installation

Add this line to your application's Gemfile:

gem "activestorage-aliyun"

And then execute:

$ bundle

Usage

NOTE! Current document work for Rails 6.1, if you are using Rails 6.0, please visit: https://github.com/huacnlee/activestorage-aliyun/tree/v0.6.4 You can also to use activestorage-aliyun 1.0.0 in Rails 6.0

config/storage.yml

aliyun:
  service: Aliyun
  access_key_id: "your-oss-access-key-id"
  access_key_secret: "your-oss-access-key-secret"
  bucket: "bucket-name"
  endpoint: "https://oss-cn-beijing.aliyuncs.com"
  # path prefix, default: /
  path: "my-app-files"
  # Bucket public: true/false, default: true, for generate public/private URL.
  public: true

Custom Domain

aliyun:
  service: Aliyun
  access_key_id: "your-oss-access-key-id"
  access_key_secret: "your-oss-access-key-secret"
  bucket: "bucket-name"
  endpoint: "https://file.myhost.com"
  public: false
  # Enable cname to use custom domain
  cname: true

Use for image url

Original File URL:

<%= image_tag @photo.image.url %>

Thumb with OSS image service:

class Photo < ApplicationRecord
  def image_thumb_url(process)
    self.image.url(params: { "x-oss-process" => process })
  end
end

And then:

<%= image_tag @photo.image_thumb_url("image/resize,h_100,w_100") %>

Use for file download

If you want to get original filename (Include Chinese and other UTF-8 chars), for example: 演示文件 download.zip, you need present disposition: :attachment option.

#
<%= image_tag @photo.image.url(disposition: :attachment) %>

Contributing

Run test

$ bin/test test/activestorage_aliyun_test.rb
# run a line
$ bin/test test/activestorage_aliyun_test.rb:129

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].