Hi, I'm brand new to RMagick (and pretty new to Rails for that
matter!). Right now, site owners are allowed to upload product and
ingredient photos to the website. Everything works great, ingredients
are sized down and proportioned correctly...the problem is that the
resulting images are so blurry! So I've been doing some research and
it looks like Paperclip::Processor may be the way to go. Here is what
I have so far:
def make
src = @file
image = Magick::Image.read(File.expand_path
(src.path)).first
image.sharpen(10, 10)!
# Create Templfile object and write image data to its file
dst = Tempfile.new([@basename, @format].compact.join("."))
dst.binmode
image.write(File.expand_path(dst.path))
# Return Tempfile object to Paperclip for further handling
return dst
end
end
end
But, I'm not having any luck. I just grabbed most of this code from
another site and have been trying to adapt it...but to no avail! Any
help or advice would be greatly appreciated!
Depends what exactly your error is, but I seem to recall RMagick having
issues with TempFile's default naming convention. The default processor
deals with that. Try subclassing Paperclip::Thumbnail instead?
If not, could you provide more details on the nature of the actual
error?
Hi, I'm xxxxx new to RMagick (and pretty new to Rails for that
matter!). Right now, site owners are allowed to upload product and
ingredient photos to the website. Everything works great, ingredients
are sized down and proportioned correctly...the problem is that the
resulting images are so blurry!
I apologize for the poor description. What I should have said is that
nothing appears to happen at all. I don't see any errors logged, the
thumbnail is still created, but it doesn't appear to be any different
than before (when I wasn't using the processor). I appreciate
everyone's feedback, looks like I've got a couple of things I can try.
It seems that my processor isn't even being fired. There is no
evidence that it is even being called. I have it in the RAILS_ROOT/lib/
paperclip_processors directory and I've double checked the file names.
Does anyone have any idea what I'm doing wrong here?