
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
== Attachment Magick
Attachment Magick is a gem to upload images and videos(vimeo and youtube) using swfupload. Supports Mongoid and ActiveRecord.
== Installation
Add to Gemfile
gem 'attachment_magick'
After the gem installation, run the generator
rails g attachment_magick:install
The generator will install swfupload (js and css files) and will create some routes.
And if you are using ActiveRecord, run this too
rails g attachment_magick:migration
Create a initializer like this (config/initializers/attachment_magick_setup.rb)
AttachmentMagick.setup do |config| # config.default_add_partial = '/attachment_magick/add_image' # default
# You can set grid size manually:
config.columns_amount = 16
config.columns_width = 52
config.gutter = 8
# Or with our magick :)
# config.parse_stylesheet('name_of_my_grid_file.css')
config.orms = ["ActiveRecord", "Mongoid"] # Mongoid is default
config.custom_styles do
publisher "52x"
my_custom_style "50x50"
end
end
Add to application.rb
config.middleware.insert 0, 'Rack::Cache', { :verbose => true, :metastore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/meta"), :entitystore => URI.encode("file:#{Rails.root}/tmp/dragonfly/cache/body") } # unless Rails.env.production? ## uncomment this 'unless' in Rails 3.1, ## because it already inserts Rack::Cache in production
config.middleware.insert_after 'Rack::Cache', 'Dragonfly::Middleware', :images
== Getting started
Include the js files to your application layout or page
javascript_include_tag :defaults, "swfupload/handlers", "swfupload/swfupload"
Include AttachmentMagick Module to your model
class Post include AttachmentMagick
attachment_magick
end
Call this helpers in form views
attachment_progress_container @post attachment_for_view @post attachment_for_video @post attachment_for_flash @image.photo.url
For customize your list for images attachment_for_view @post, 'path/my_partial'
== Customizing views
=== Just Images
<%= link_to "[x]", "javascript://", :class => "remove_image", :style => "float:right;"%>
<%= attachment_for_view @post, "path_to_my_partial" %>
== Customizing sizes
class Post include AttachmentMagick
attachment_magick do
grid_1 "100x100"
end
end
== Credits
Author: Marco Singer Contributors: Lucas Renan, Carlos Brando
== See in RubyGems.org (http://rubygems.org/gems/attachment_magick)
FAQs
Unknown package
We found that attachment_magick demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.