shrinerb / shrine-fog Goto Github PK
View Code? Open in Web Editor NEWFog storage for Shrine
Home Page: http://fog.io/
License: MIT License
Fog storage for Shrine
Home Page: http://fog.io/
License: MIT License
in shrine-fog (1.0.0) lib/shrine/storage/fog.rb
line 39:
signed_url = file(id).url(Time.now + @expires, **options)
In fog-google (0.6.0) lib/fog/storage/google_xml/models/file.rb
line 130:
def url(expires)
requires :key
collection.get_http_url(key, expires)
end
Looks like the url
method doesn't take options any more.
UPDATE: Same problem in fog-google
version 1.3.3
Hi,
I'm trying to use this gem with fog-rackspace 0.1.5
and uploads are working, but then all the files are referencing the API endpoint http://storage101.syd2.clouddrive.com/v1/MossoCloudFS_922621/
as the base URL when using attachment_url
method on the model, which isn't a publicly accessible path, instead of something public.
Carrierwave uses an independent config called asset_host
to generate public URLs, and fog-rackspace has the options :rackspace_storage_url
and :rackspace_cdn_url
, but not sure if those are accessible/which one would be ideal for this use case?
It looks from the following code lines I think that the URL generation is using the API endpoint path, not something public?
shrine-fog/lib/shrine/storage/fog.rb
Lines 38 to 48 in b053ade
Sorry for explaining that terribly.
I seem to be getting the following error when submitting my form for my model:
no implicit conversion of ActionDispatch::Http::UploadedFile into String
Some details of my setup are below:
Rails 6.0.2.2
Ruby 2.6.0p0
gem 'fog-backblaze', '> 0.3.0’
gem 'shrine-fog', '> 2.0', '>= 2.0.1’
gem 'shrine', '~> 3.2', '>= 3.2.1'
Model
class Show < ApplicationRecord
include ImageUploader::Attachment(:artwork)
end
Image Uploader
class ImageUploader < Shrine
plugin :store_dimensions
Attacher.validate do
validate_max_size 1010241024
validate_mime_type %w[image/jpeg image/png]
validate_extension %w[jpg jpeg png]
end
end
Shrine.rb
require "shrine"
require "shrine/storage/fog"
require "fog/backblaze"
storeb2 = Fog::Storage.new(
provider: 'backblaze',
b2_key_id: ‘###',
b2_key_token: ‘###',
b2_bucket_name: ’test',
b2_bucket_id: ‘###'
)
Shrine.storages[:store] = Shrine::Storage::Fog.new(
connection: storeb2,
directory: “test",
)
Shrine.storages[:cache] = Shrine::Storage::Fog.new(
connection: storeb2,
directory: “test",
)
Shrine.plugin :activerecord
Shrine.plugin :cached_attachment_data
Shrine.plugin :restore_cached_data
Shrine.plugin :validation
Shrine.plugin :validation_helpers
Controller Code Where it is blowing up
def create
@show = Show.new(show_params)
if @show.save
flash[:notice] = "The new show has been added to your account"
redirect_to @show
else
render :new
end
end
private
def show_params
params.require(:show).permit(:title, :artwork)
end
Do you know what this could be?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.