paperclip

Rails Plugin: Paperclip Question

How can I prevent the image tag that calls the associated image from displaying if no image is associated with the record? <%= image_tag @agent.avatar.url %> ...gives me the text "Missing" if there is no image associated with that agent. I want to test to see there is an image available first, then render the above tag if the test re...

Ruby on Rails: Paperclip with multi-step-form

I am using the fine paperclip plugin for rails. Everything is nice so far, users can upload images. Now i want an extra step before my model is saved, asking for confirmation by the uploader that the image looks right. Is this possible to do with paperclip? If so, how? ...

Rails: Image cropping with Paperclip, S3 and RMagick.

Hey all, I'm currently trying to code a custom image cropping system similar to other ones on the internet where a user can select a cropping area and then have their image cropped accordingly. The application is in Rails and we're using Paperclip with Amazon S3 to store the files. I'm having a lot of trouble though getting RMagick to ...

Where is my rails installation located? Where are the rails plugins?

I'm trying to delete a plugin I installed for rails (paperclip). But I actually don't have any idea where I can find my local rails installation directory. So where can I find rails and rails plugins in my local file system? I have OS X. Or how can I uninstall paperclip from the command line? Thx! ...

How to integrate Paperclip and Mimetype-fu

First, a little background, because there is a lot of interaction going on: I'm grabbing emails via Fetcher, and processing them using MMS2R to extract the attachments. These attachments are generally going to be PDF files or MS Word documents, so you'd expect that their content-type would be application/pdf and application/msword respec...

Set path for original images using paperclip in Rails?

The situation I have a simple model with an attached image using paperclip, which has a couple of processed styles for it (thumbnail, full, feature). At this point it works as it should, and makes a directory structure for each object in /public/assets/foo/, containing subdirectories for original, thumbnail, full, and feature. The prob...

Using Rails with Paperclip and SWFUpload

I have a basic rails application test with a user model that has a photo field handled with paperclip. I created the views to be able to create/edit an user and the photo uploading is working nicely. <h1>Editing user</h1> <% form_for :user, @user, :url => user_path(@user), :html => { :method => "put", :multipart => true } do |f| %> ...

Simple cropping with Paperclip

I would like to crop images on upload using Paperclip to get square thumbs from the center of the original picture. I find out a method in documentation that seems to do exactly what I want: transformation_to(dst, crop = false) The problem is that I can't figure out where to use this method. It would be great to simply pass something a...

Multiple Uploads to Amazon S3 from Ruby on Rails - What Background Processing System to Use?

I'm developing a Ruby on Rails application that needs to allow the user to simultaneously upload 16 high-quality images at once. This often means somewhere around 10-20 megabytes (sometimes more), but it's the number of connections that are becoming the most pertinent issue. The images are being sent to Amazon S3 from Paperclip, which ...

Nil Reference when Update

I am trying to get Paperclip working with MiniExiftool. I finally wrote this: # Photo model belongs_to :user has_attached_file :picture after_picture_post_process :copy_exif_data private def copy_exif_data exif = MiniExiftool.new picture.queued_for_write[:original].path self.date = exif['date_time_original'] ...

can you pass self to lambda in rails?

I want to define a class method that has access to a local variable. So this would be different for each instance of the class. I know you can make a class method dynamic with lambda like when you use it with named_scope. But can this be done for values that are specific to an instance? In detail it is the has_attached_file method for...

Downloading big files (~40MB) and saving as attachments with paperclip

I have found some code ` require 'socket' host = "download.thinkbroadband.com" path = "/1GB.zip" # get 1gb sample file request = "GET #{path} HTTP/1.0\r\n\r\n" socket = TCPSocket.open(host,80) socket.print(request) # find beginning of response body buffer = "" while !buffer.match("\r\n\r\n") do buffer += socket.read(1) end response ...

Generating a unique file path with Polymorphic Paperclip

I'm running into an issue with different users uploading files with the same name being overwritten with the Polymorphic Paperclip plugin. What I'd like to do is inject the current user's ID into the URL/path. Is this possible? Would I be better off generating a random name? Here are my current :url and :path parameter values in asset.r...

How can you send a file to S3 after all processing is done using paperclip in rails?

I have a rails app with Video and Image models. Both use SWFUpload for progress indication feedback and queued uploading. So they are uploaded to a TempImage, and TempVideo model then when the ActiveRecord Video and Image models are saved the temps are moved over. On the images the different styles are created with the default paperc...

How to crop & fill with Paperclip (or RMagick) ?

I upload a photo, it is a rectangle. How Can I get it resized and filled to a square ? I mean when the photo is horizontal positioned it should have above and under it, two white fields (for keeping the shape of a square) and when it is vertically, it should have two white fields on the sides of the photo. When I used PHP, a have used ...

How do I apply a drop shadow to thumbnails using imagemagick and paperclip?

I would like to alter the processing of thumbnails in paperclip by having imagemagick apply a drop shadow to all the thumbnails. What I'm stuck on is the actual imagemagick command that would pull this little miracle off. Everything I've tried returns an incorrectly scaled drop shadow without the original image. def transformation_com...

paperclip run processors on selected style

I have an :xxx image processor, and I have two styles in the model :big and :thumb. How I can process with :xxx only the :thumb image leaving the :big image untouched ? ...

View helper in Paperclip interpolation

I have a paperclip interpolation that I want to use one of my view helpers for. I have the route set up so I can use foo_bar_photo_path so I just want to use that in the interpolation as well. Paperclip::Attachment.interpolations[:mykey] = lambda do |a,s foo_bar_photo_path(something,something) end Unfortunately, it whines with u...

Paperclip save attachment

Is there a better way to save some string as an attachment via Paperlip as making a tmp file, putting the string into it, opening it again and saving it as an attachment ? Like this : def save_string data tmp_file = "/some/path" File.open(tmp_file,'w') do |f| f.write(data) end File.open(tmp_file,'r') do |f| ...

Custom thumbnails for file types with Paperclip

I'm using Paperclip with a Ruby on Rails to attach assets to a model, these assets can be any file type and currently thumbnails are only being generated if the asset is an image. I'd like to be able to display a different default image for other files, either by generating a thumbnail of the files on upload, or setting something up wit...