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?
...
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 ...
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_...
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 ...
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
...
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...
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...
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...
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.
...
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...
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::...
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}/...
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...
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...
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...
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 =>...
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...
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...
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...
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
...