Socket
Book a DemoInstallSign in
Socket

attachment_magick

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attachment_magick

0.3.6
bundlerRubygems
Version published
Maintainers
3
Created
Source

== 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

  • Attachment Magick is based on 960 Grid System (http://960.gs/)

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

<%= image_tag image.photo.thumb(image._parent.class.style_publisher).url%>
<%= 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

Package last updated on 28 Jul 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.