Thanks Luis, btw, I found some hints, it failed when the 'puts' statement
was called. 

That's why the uploading of image failed, while other types are fine, when I
upload an image, I need to crop the image which instead call
Base64.b64encode, in which "puts" was called to display the output on
console.

So I did a simple test, I added puts before the execution of anything, and
it failed exactly at that line:

  def with_image(file_data = nil, &block)
    puts "testing"

    img = Magick::Image::read_inline(Base64.b64encode(file_data ||
self.data)).first
    block.call(img)
    img = nil
    GC.start
  end  


Error message thrown:

#{RAILS_ROOT}/app/models/asset.rb:115:in `write'
#{RAILS_ROOT}/app/models/asset.rb:115:in `puts'
#{RAILS_ROOT}/app/models/asset.rb:115:in `with_image'
#{RAILS_ROOT}/app/models/asset.rb:100:in `crop_image_size'

Now we are getting close, why puts failed when running as windows service?
Note that it works fine when I'm running with "mongrel_rails start"

And here are my answers to your questions. Thanks!

1) What plugin are you using to manage upload attachments? (since I
see you have a crop_image_size and with_image inside Asset model

I'm using rmagick-win32 with ImageMagick installed. Rmagick 1.13.0 and
ImageMagick 6.2.9-3 Q8.

I didn't use any plugin, I developed the file upload handling myself, with
some tricks learned from file_column and acts_as_attachment.

2) From the service command line, you have ruby installed in E:\Ruby.
Is this directory in your path? (Open a new console, type PATH and hit
enter, tell me if E:\Ruby is in there).

"E:\ruby\bin" is there.

-------------

PATH=E:\Program Files\Windows Resource Kits\Tools\;e:\program
files\imagemagick-6.2.9-q8;e:\ruby\bin;C:\Perl\bin\;C:\WINDOWS\system32;C:\W
INDOWS;C:\WINDOWS\Syst
em32\Wbem;C:\PROGRA~1\ULTRAE~1;C:\Program Files\Common Files\Adaptec
Shared\System;C:\Program Files\Microsoft SQL
Server\80\Tools\BINN;E:\PROGRA~1\ATT\Graphviz\
bin;e:\Program Files\WinSCP3\;e:\Program Files\Subversion\bin;C:\Program
Files\QuickTime\QTSystem\;E:\Program Files\Support
Tools\;D:\jdk\jdk1.5.0_04\bin;C:\Program
Files\CVSNT\;d:\java\apache\apache-ant-1.6.2\bin;D:\java\apache\Maven
1.0.2\bin\;e:\program files\xampp\mysql\bin;c:\php;c:\php-4.4.0;e:\program
files\svn-win32-1.3.1\bin;D:\rubywork\bin;E:\Program Files\Windows Resource
Kits\psexec


3) You also tested the service as "console", could you please indicate
the location of the temp file under that situation? C:\Windows\Temp do not
seems right for a process running with Administrator or any other account
credentials.

Sorry my mistake Luis running service as "console", throwing this message
instead:

{"project_id"=>"1",
 "commit"=>"Upload file",
 "attachment"=>{"0"=>{"private"=>"0",
 "category_id"=>"",
 "description"=>"",
 "file"=>#<File:C:/DOCUME~1/Herry/LOCALS~1/Temp/CGI.1936.0>}}}

While running it as normal windows service, the temp directory is
"c:\windows\temp".

4) Since you mention RMagick, are ImageMagick binaries in the path too?

Yep image magick is in the path. I can run 'convert' command.

_______________________________________________
Mongrel-users mailing list
Mongrel-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to