paperclip

paperclip private files

Is there a way to make paperclip attachments private? As in only where I explicitly want a user to be able to access a file, can the user access the file. Obviously the file can't be in a public directory, but how do I get paperclip to check the user's access rights when trying to access that file to begin with? ...

where from does paperclip get the name of original file?

i started using nginx upload module (which creates upload files like /tmp/000121545) but i need paperclip to use original filename while saving files (like /public/avatars/LuckyLuke.jpg) previously in the parameters Rails were passing just "avatar"=>#<File:/tmp/RackMultipart20100413-6151-t3ecq0-0> no original filename as well, so ...

How to get image capture date and video duration when uploading files using SWFUpload and Paperclip on Rails

Hi Guys, I'm using SWFUpload and Paperclip on Rails 2.3.5 to upload images and videos. How can I store the capture date of images and duration of videos? The following works correctly in irb: irb(main):001:0> File.new('hatem.jpg').mtime => Tue Mar 09 16:56:38 +0200 2010 But when I try to use Paperclip's before_post_process: before_...

Remove unncessary error raised by paperclip - filename is not recognized by the 'identify' command.

I've been searching on how to solve this issue but could not find any real and working solution. User model: validates_attachment_content_type :avatar, :content_type => ['image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/gif'] Unnecessary error shows up when invalid file type is uploaded: Avatar /tmp/sample,23283,0.txt ...

Paperclip Refreshing of Thumbnails not working with S3

I have Paperclip installed as a gem and i am trying to refresh the thumbnail size of the images. I'm running this command: rake paperclip:refresh:thumbnails CLASS=User and receiving this error: ...rake aborted! The specified key does not exist. Any ideas? Finn ...

RoR - Paperclip - How to set minimal width of an attachement

Hi, my layout's requirement is to keep all thumbnails at 80px height, not higher, not smaller. In my model I set the style to :thumb=> "500x80>", so basically almost every picture which is not too wide gets its perfect miniature with 80px height. Sometimes, however, my pictures are narrow and high, so the thumb can have unclickable dimen...

Installing Paperclip - "undefined method `has_attached_file` for" - Ruby on Rails

I just installed the plugin for Paperclip and I am getting an error message "undefined method has_attached_file for. Not sure why I am getting this. Here is the full error message. NoMethodError (undefined method `has_attached_file' for #<Class:0x10338acd0>): /Users/bgadoci/.gem/ruby/1.8/gems/will_paginate-2.3.12/lib/will_paginate/fi...

WYSIHAT 'resonds_to_parent" undefined method - Ruby on Rails

I just successfully installed WysiHat in my rails blog. Seems that the 'add a picture' feature is not working. It successfully allows me to find and select a picture from my desktop but upon clicking save, it does nothing. I also have Paperclip successfully installed and can attach images to records outside the WYSIHAT form field. An...

File upload with Sinatra.

I am trying to be able to upload files with Sinatra. I have the code here, but I'm getting the error "method file_hash does not exist" (see /lib/mvc/helpers/helpers.rb). What is going on here? Is there some dependency I'm missing. ...

Rails - building an absolute url in a model's virtual attribute without url helper

I have a model that has paperclip attachments. The model might be used in multiple rails apps I need to return a full (non-relative) url to the attachment as part of a JSON API being consumed elsewhere. I'd like to abstract the paperclip aspect and have a simple virtual attribute like this: def thumbnail_url self.photo.url(:thu...

Getting Paperclip to work in Rails

Hi Everyone, I have installed the Paperclip plugin to attempt to upload an avatar for my kase model. For some reason, the select the file button shows, and I can choose a file - but then when I click update the kase - it takes me to the show page, but the missing.png rather than the selected image. kase.rb class Kase < ActiveRecord::...

Rails + Dragonfly gem: Saving image in a directory structure based on ActiveRecord object attributes

I'm using dragonfly gem to manage images and attachments in my rails app and I need to store images in a specific directory structure based on my user model. let' say I have user model which has a name and each user has many albums, which have a name also, then I want the images to be stored in "#{RAILS_ROOT}/public/system/#{user.name}/...

Paperclip renaming files after they're saved

How do I rename a file after is has been uploaded and saved? My problem is that I need to parse information about the files automatically in order to come up with the file name the file should be saved as with my application, but I can't access the information required to generate the file name till the record for the model has been sav...

Image_tag .blank? - paperclip - Ruby on rails

I have just installed paperclip into my ruby on rails blog application. Everything is working great...too great. I am trying to figure out how to tell paperclip not to output anything if there is no record in the table so that I don't have broken image links everywhere. How, and where, do I do this? Here is my code: class Post < Active...

Paperclip: delete attachment and "can't convert nil into String" error

I'm using Paperclip and here's what I do in the model to delete attachments: def before_save self.avatar = nil if @delete_avatar == 1.to_s end Works fine unless @delete_avatar flag is set when the user is actually uploading the image (so the model receives both params[:user][:avatar] and params[:user][:delete_avatar]. This re...

Paperclip won't save image in Rails app

Hello stackoverflow. I am trying to use Paperclip with my Rails app to add an avatar to a user but it won't save my image or update the database column when creating the user. This is what the model looks like: class User < ActiveRecord::Base has_attached_file :avatar And the registerform in haml: - form_for :user, @user, :url =>...

Rails 2.3.2: Accessing Model Specific Data in Another Model

I'm using Rails 2.3.2 and using Paperclip to upload photos. I'm also using a slightly customized subdomain_accounts.rb to set some account-specific variables. My question is this: How can I set the bucket used in Paperclip to be dependent on the current account? Since this looks to be a model attribute set up early on, how can I overri...

Dynamic Attachment Size for Paperclip (Rails)

Is there anyway to have the validates_attachment_size except a dynamic file size limit? Here's an example: class Document < ActiveRecord::Base belongs_to :folder has_attached_file :document validates_attachment_size :document, :less_than => get_current_file_size_limit private def get_current_file_size_limit 10.mega...

Get paperclip to crop the image without validating

Hello fellow stackoverflow members. I have been following this guide to enable users to have their own avatar. But i have bumped in to a litle problem. When the user is cropping the image the model tries to validate all my validations. My user model looks like this: class User < ActiveRecord::Base has_attached_file :avatar, :styles...

Paperclip Resize to fit a rectangular box

I have a rectangular image for example 30x800 pixels How I can scale it with paperclip to preserve the aspect ratio to a 100x100 pixel image with borders filling the empty area ? an example : http://www.imagemagick.org/Usage/thumbnails/pad_extent.gif ...