Skip to content

Instantly share code, notes, and snippets.

@vinniefranco
Created March 3, 2011 01:56
Show Gist options
  • Save vinniefranco/852171 to your computer and use it in GitHub Desktop.
Save vinniefranco/852171 to your computer and use it in GitHub Desktop.
# Create a new image
ruby-1.9.2-p136 :120 > image = Image.new()
=> #<Image id: nil, table_name: nil, table_id: nil, title: nil, description: nil, tiny: nil, small: nil, medium: nil, large: nil, original: nil, dcreate: nil, asset_file_name: nil, asset_content_type: nil, asset_file_size: nil, asset_updated_at: nil, asset_remote_url: nil>
# Set a style dynamically
ruby-1.9.2-p136 :126 > image.asset.styles[:large] = Paperclip::Style.new(:large, '300x300#', image.asset)
=> #<Paperclip::Style:0x00000100f0f5e0 @name=:large, @attachment=/assets/original/missing.png, @geometry="300x300#", @format=nil, @other_args={}>
# Add a new asset and BOOM
ruby-1.9.2-p136 :127 > image.asset = File.new(Rails.root+'public/images/rails.png')
sh: line 1: 3445 Trace/BPT trap: 5 identify -format %wx%h '/var/folders/vk/zb0rt8tx37v5x3jkvsrvjh1w++++fr/T/stream20110302-1569-1wzjw20.png[0]' 2> /dev/null
=> #<File:/Users/vinnie/Projects/groundctrl/public/images/rails.png>
@lucasrenan
Copy link

did you solved this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment