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...
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?
...
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 ...
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!
...
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...
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...
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| %>
...
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...
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 ...
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']
...
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...
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 ...
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...
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...
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 ...
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...
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 ?
...
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...
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|
...
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...