-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NoMethodError - undefined method `write' for "":String in custom processor #436
Comments
Can you provide a sample app that uses the most recent version of CW? A full stack trace would help, too. Here's an example I made to track something down: https://github.com/trevorturk/carrierwave-issue-381 |
i too am struggling with this using mini_magick's resize
if i tweak the argument (
essentially it seems that it is is wrapping the command line arguments in quotes |
oops. forgot to include |
@brewster1134 can you provide an example before/after? |
Didn't seem to make a difference for me, current_path is still @trevorturk: I used your sample Sinatra app posted on the Engine Yard blog recently as a basis for a simple app that demonstrates the issue: https://gist.github.com/1157829 |
This seems to work for me. Maybe you'd be interested in making a wiki page about it? |
Forgot the link :) https://gist.github.com/5d66897d88d1b5dfbea5 |
That did work! So the keys for processors are:
Would you like a pull request for this change? I'll see about making a wiki page for custom processing actions. |
Yeah, pull requests and wiki pages would definitely help. I agree the docs need some work. It was hard for me to tell what was the "right way" to do this :) |
The details of this Wiki addition should also be reflected in the RDOC output as found here: http://carrierwave.rubyforge.org/rdoc/classes/CarrierWave/MiniMagick.html |
http://carrierwave.rubyforge.org/ is no longer updated |
I get the same error but for a different processing : class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
# S3 Storage
storage :fog
def extension_white_list
%w(jpg jpeg gif png)
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :project_list, :if => :is_project_image? do
process :cropper
end
def cropper
manipulate! do |img|
if model.crop_x.blank?
image = MiniMagick::Image.open(current_path)
model.crop_w = (image[:width] * 0.8).to_i
model.crop_h = (image[:height] * 0.8).to_i
model.crop_x = (image[:width] * 0.1).to_i
model.crop_y = (image[:height] * 0.1).to_i
end
img.crop "#{model.crop_w}x#{model.crop_h}+#{model.crop_x}+#{model.crop_y}"
end
end
def is_project_image?(new_file)
begin
return model.model_with_project_image unless model.model_with_project_image.nil?
rescue
false
end
end
end I'm missing something or it's a real issue ? ^^ |
I have a custom processor, using MiniMagick's
manipulate!
method. Here's a summary of my code:Problem is, when processing this, CarrierWave throws an error:
It seems as though current_path is returning
""
for some reason, but I'm not too sure why.The text was updated successfully, but these errors were encountered: