Hello rails,
I tried severeal ways to send a file on my windows-pc but all of
them donŽt work. the last one i tried was send_file
i am using rails version 0.9.5 - installed via gems (ap 1.4.0, ar
1.6.0 & am 0.6.1)
the code (it asks for a rescaled version of a picture and scales and
delivers it) looks as follows:
--somecontroller--
@@SIZES = [64,96,128,192,256,384,512,768]
def get
if (@params[''id''] != nil) &&
(@params[''w''] != nil) &&
(@params[''h''] != nil)
id = @params[''id'']
w = @params[''w''].to_i
h = @params[''h''].to_i
if(w > h)
s = w
else
s = h
end
filename = "../pictures.scaled/" + id + "." + size.to_s +
".jpg"
if(!File.exist?(filename))
cmd = "convert ../pictures/" + id + ".jpg -resize " +
size.to_s + "x" + size.to_s + " -comment ''test''
-interlace plane -quality 50 "+ filename
system cmd
end
send_file filename
end
end
--somecontroller end--
the log gives only:
rocessing PictureController#get (for 127.0.0.1 at Wed Feb 23 15:28:55
Westeuropäische Normalzeit 2005)
Parameters: {"w"=>"90",
"action"=>"get", "id"=>"100",
"controller"=>"picture",
"h"=>"200"}
Completed in 0.000100 (10000 reqs/sec)
Streaming file ../pictures.scaled/100.64.jpg
and the apache log gives:
[Wed Feb 23 15:31:23 2005] [error] [client 127.0.0.1]
C:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/base.rb:469:
warning: syswrite for buffered IO\r
my dispatch.cgi (the one that apache calls) looks as follows:
---d.cgi---
#!c:/dev/ruby/bin/rubyw.exe
require File.dirname(__FILE__) + "/../config/environment"
require ''dispatcher''
SESSION_OPTIONS = {
''database_manager'' => CGI::Session::ActiveRecordStore,
''session_expires'' => Time.now + 60 * 60 * 24 * 30
}
ADDITIONAL_LOAD_PATHS.each { |dir| $:.unshift
"#{File.dirname(__FILE__)}/../#{dir}" }
Dispatcher.dispatch
--d.cgi end---
does anyone have an idea what might be the cause of my 500?
thank you
roman