I have a model that handles all my uploads of different filetypes.
- How do I create a style with the same name as the :basename so that the url will be the same for images and non-image files?
I have a model that handles all my uploads of different filetypes.
Try this
class Upload < ActiveRecord::Base
has_attached_file :photo,
:styles => {
:thumb => {"115x70>"},
:orig => {"300x168>"} }
..
As long as you specify two different styles, it'll create two different styles associated with your Upload object.
Then you can call them via :
= image_tag @upload.photo.url(:thumb)
= image_tag @upload.photo.url(:orig)
Huh?
The thumbnails will be created when the new file is assigned, but they will not be saved until save is called on the record. Likewise, if the attribute is set to nil is called on it, the attachment will not be deleted until save is called. See the Paperclip::Attachment documentation for more specifics.
I know this is a simple question, but are you sure you have ImageMagick installed properly? Most problems that I've ran in to happen because ImageMagick isn't compiled/installed correctly. If you watch the logs, Paperclip will hum along and silently fail.
You are going to need to create a custom processor, then inside that processor you can call the IM methods for images and ignore the rest.
I didn't put much research into it, but this link might get you headed in the right direction: http://thewebfellas.com/blog/2009/2/22/video-thumbnails-with-ffmpeg-and-paperclip