Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
carrierwave-filepickerio
Advanced tools
FilePicker.io support for CarrierWave.
Install the latest stable release:
gem install carrierwave-filepickerio
In Rails, add it to your Gemfile:
gem 'carrierwave-filepickerio'
Add your FilePicker.io API key to the CarrierWave initializer:
CarrierWave.configure do |config|
# ... add the following
config.filepickerio_api_key = '[Your API key]'
end
After setting up your CarrierWave uploader as per normal (see the CarrierWave site for more information) you need to configure your page to use the Filepicker.io widget.
First of all, include the filepicker.io JavaScript library in your page (such as your application.html.erb layout):
<%= javascript_include_tag "//api.filepicker.io/v0/filepicker.js" %>
... or, if you're not using the asset pipeline, you can use the expansion:
<%= javascript_include_tag :filepickerio %>
To use the FilePicker.io uploader you need to call the view helper like so:
<%= form_for @entry do |f| %>
<%= f.fp_file_field :image %>
<%= f.fp_save_button :image, "Save existing image to cloud", 'image/jpeg' %>
<%- end %>
You can change the button text by passing along a string as the first parameter
<%= f.fp_file_field :image, "Pick a picture" %>
To include a drag-n-drop area pass the dragdrop parameter in the options hash, which is the last parameter.
<%= f.fp_file_field :image, "Pick a picture", dragdrop: true %>
You can also attach any other events to the input as normal, for instance you can listen to change events:
<%= f.fp_file_field :image, "Pick a picture", dragdrop: true, onchange: '$("#pic").attr("src", arguments[0].files[0].url)' %>
Specify any Filepicker.io additional data options in the data hash
<%= f.fp_file_field :image, "Pick a picture", data: { 'fp-mimetypes' => 'image/jpeg,image/png' } %>
You may include any of the additional parameters...
Any additional Filepicker.io configuration can be passed within an optional data hash passed to the view helper method.
<%= f.fp_file_field :image, data: { "fp-button-text" => "Pick a lolcat to upload" } %>
See https://developers.filepicker.io/docs/web/ for a full list of configuration options.
FAQs
Unknown package
We found that carrierwave-filepickerio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.