Displaying 20 results from an estimated 70000 matches similar to: "I need to save image from RAW_POST_DATA"
2010 Mar 17
3
Associating a default paperclip image from a different model
Here''s some code, this is my NewsItem model as you can see...
class NewsItem < ActiveRecord::Base
belongs_to :country
has_attached_file :image, :styles => { :original => ''57x57'' },
:default_url => ''/images/football.png''
# has_attached_file :image,
# :styles => { :original => ''57x57'' },
2010 Aug 08
2
paperclip save to disk and s3
I have a standard Paperclip setup that saves a file to my disk. In
addition I would also like the file saved to my amazon s3 bucket.
[code]
after_save :copy_to_s3
def copy_to_s3
has_attached_file :photo,
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:styles => {
:thumb => "100x100#",
:small => "750x750>"
2010 Sep 01
1
Faking Paperclip has_attached_file with Factory girl?
Hello!
I wonder if it''s possible to simulate Paperclip''s has_attached_file
with Factory Girl and then test it with Rspec. I don''t get it to work.
My factories.rb file looks like this:
Factory.define :user do |user|
user.name "Anders"
user.email "user-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org"
user.password
2011 May 14
0
Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7
Hello,
I am trying to use the paperclip plugin in my rails app to upload images
for posts. I am using Rails 2.0.2 and ruby 1.8.7 on Ubuntu 10.04 os for
project specific purposes.
I am referring to the following tutorials for this :-
1. http://railscasts.com/episodes/134-paperclip?view=comments
2.
http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails.html
I did a git clone on the
2012 Jan 25
0
Paperclip preserve files ?
Hi,
I am using paperclip to upload files. The problem I am facing is,
based on my object property I need to preserve my file. Means my object
should be deleted from db but the file need to be restored.
I am using the option :preserve_files => true.
If I keep the above option in model it will be access to all the
objects of the model. I need to restore only for limited objects.
2011 Feb 15
0
Question on Paperclip paths/urls
Note that if I use the default Paperclip :path (i.e. not setting this
attribute and files going to public/system), everything is fine. This
question is to do with setting an alternative path.
I have a model using paperclip for a file with a custom path:
has_attached_file :tu_raw_bill_csv,
:path =>
2011 Aug 07
2
PROBLEM WITH PAPERCLIP
hello,
i am trying to upload a image file ...using paperclip in rails 3
i did as follows
1. In gemfile => included gem paperclip
2.In config/environments /development.rb => Paperclip.options[:command_path]
= "/usr/bin/" (convert path)
3.created a controller *picusers *and defined => def create
@picuser = Picuser.create(params[:picuser])
end
4.created a model *picuser
2010 Nov 02
0
Can't use paperclip plugins
development env:
Ubuntu 9.04
ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
rails -v
Rails 3.0.0
gem -v
1.3.7
Here what I did:
rails new testpaperclip -d mysql
cd testpaperclip
rake db:create
rails g scaffold user name:string address:string
rake db:migrate
== CreateUsers: migrating
====================================================
-- create_table(:users)
->
2011 Jan 08
1
Paperclip custom Interpolation in url
Folks,
I have a simple model hierarchy (reduced to example as below)
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
has_attached_file :photo,
# :url => "/assets/class_cal/<original post
date>/:id/:style/:basename.:extension"
:url =>
2010 Oct 29
8
Amazon s3 - paperclip - Rails3 - basic setup Noob simple problems
Hi all, I''ve got a feeling from other posts that this should be very
simple, but believe me I''ve looked around many tutorials / blogs, but
still cant even get the most basic setup working with paperclip and s3.
I am however pretty new to Rails, so could be doing something dumb.
-------
Firstly, to install and use paperclip and aws-s3 I''ve got them both in
by Gemfile:
2010 Feb 15
4
Changing the :path and :url options of has_attached_file in paperclip
Hello,
I am using the paperclip plugin to upload images and it works
absolutely fine.
I intend to save my uploaded images to C:\Application_name\public
folder. Accordingly, with some study over the i-net, I changed
the :path option of has_attached_file to -
:path => "C:/Application_name/
public/:class/:attachment/:id/:style_:basename.:extension"
Now, the files are being saved to
2011 Apr 05
2
"Lazy" image resizing?
I''m looking at Dragonfly, which seems to offer what I''m looking for in
this area: the ability to upload an image, then later request that
image at a different geometry, and either get a cached copy of that
resized image, or create and cache that image.
Can anyone point me to alternatives? Is this something that can be
added to Paperclip? I''ve only ever used
2010 Apr 01
2
paper clip plugin error
coming this error in my paper clilp plugin m getting this error
* Photo C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/
hrithik_roshan1,3756,1.jpg is not recognized by the ''identify''
command.
* Photo C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/
hrithik_roshan1,3756,1.jpg is not recognized by the ''identify''
command.
* Photo C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/
2012 Feb 17
5
undefined method `key?' for nil:NilClass PaperClip
Hello, I have a problem with the paperclip, I put on my GemFile
gem "paperclip", "~> 2.6.0"
I create a migrate
class FileUpload < ActiveRecord::Migration
def up
change_table :projects do |t|
t.has_attached_file :image
end
end
def down
drop_attached_file :projects, :image
end
end
on my model I put
class Project < ActiveRecord::Base
2012 Aug 18
2
Paperclip images are not stored in my directory
It is my User.rb model,
My images are not stored in my assets directory..
has_attached_file :photo, :styles => { :small => "100x100#", :large =>
"500x500>", :thumb => "60x60>" },
:url => "/assets/users/:id/:style/:basename.:extension",
:path =>
2011 Jan 03
2
Adding style to model (paperclip)
hello,
I have a model (item) with one attachment (photo) and one style (small):
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => { :small => "50x50"},
end
I would like to add a new style (:large), so I modify item.rb:
class Producto < ActiveRecord::Base
has_attached_file :photo, :styles => {{ :small => "50x50"},{ :large =>
2011 Feb 23
0
Dynamically setting Paperclip processors with attachment instance data
I''m trying to dynamically set my Paperclip processors which are stored
in my database, ideally I would want to access
attachment.instance.paperclip_processor, but I can''t seem to do that.
Any ideas?
# class Post < ActiveRecord::Base
has_attached_file :image,
:path => ":rails_root/
public/:hash_path/:style/:basename.:extension",
:processors => lambda {
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
I'm using Rspec and FactoryGirl to create specs for multimodel paperclip
attachments. From searching other questions, it seems like a single
image attachment is more common.
Car.rb
class Car < ActiveRecord::Base
has_many :uploads, dependent: :destroy
validates :uploads, presence: { message: 'You must upload at least
one image' }
2011 Aug 22
0
Paperclip nested resources problem
My models:
class Country < ActiveRecord::Base
has_many :regions
has_many :assets, :dependent => :destroy
accepts_nested_attributes_for :assets
end
class Region < ActiveRecord::Base
belongs_to :country
has_many :appartments
has_many :assets, :dependent => :destroy
accepts_nested_attributes_for :assets
end
class Asset < ActiveRecord::Base
belongs_to :region
2010 Jul 07
0
Paperclip polymorphic styles problem
I made my model Picture polymorphic and this model use paperclip. Now I
want to specify :styles for the model that have many pictures, but I
can''t find a solution to fix this. At the moment I use this and all is
working good :
http://pastie.org/1034105
But for example for model Brand I need different styles then for model
Product.
I tried a lambda like this :
:styles =>