Hi there,
since two days or so my application doesn’t seem to execute the system method. I use it for generating thumbnails like:
def create_thumb(field,image_name)
thumb_name = "..."
path = "..."
# call ImageMagick method from console
command = "convert -thumbnail 120x120 " + path + image_name + " " + path + thumb_name
[logger.info](http://logger.info)("UPLOAD: before converting to 120x120 with #{command}")
system(command)
.....
end
The output to the logger is correct. When I execute the command string in the console (rails console or linux console) it works. But it seems not to work inside my Rails controller, which is really weird. It just don’t gets executed. I don’t get any error messages, any. Where else can I look?
Thanks for any help.
Chris
Have you looked at the return value of system and $?
Fred
Thank Fred,
didn’t know about that possibility. But unfortunately the result is 0. So it’s really bad magic to me. Am trying to set the command path manually. Maybe that works.
Seems that I had to write the full path to convert. That might be cause by a problem I had with rmagick and had to install ImageMagick in two different ways (from source and from rpm) at the same time. It had screwed the path to convert. But somehow the rails console and linux console had no problem with the path, only a controller method.
When I removed all the comments and the loggin’ calls I didn’t work again. So I left them. Somewhere along the ‘path’ there must be a problem. When I solve that I gonna tell you.
Seems that I had to write the full path to convert. That might be cause by a problem I had with rmagick and had to install ImageMagick in two different ways (from source and from rpm) at the same time. It had screwed the path to convert. But somehow the rails console and linux console had no problem with the path, only a controller method.
When I removed all the comments and the loggin' calls I didn't work again. So I left them. Somewhere along the 'path' there must be a problem. When I solve that I gonna tell you.
You could easily be running as a different user which could cause $PATH to have different values.
Fred