Displaying SVG images

I cannot get SVG to display under Rails even using the normal html
embed command. I suspect it might have to do with a mime setting but
not sure. The Scruff SVG graph library is written in Ruby so it
obviously can be done. Any help? thks.

On Jan 13, 2007, at 1:24 PM, john wrote:

I cannot get SVG to display under Rails even using the normal html
embed command. I suspect it might have to do with a mime setting but
not sure. The Scruff SVG graph library is written in Ruby so it
obviously can be done. Any help? thks.

The real question is more like: “Does my browser understand how to
render SVG?”

Or perhaps: “How can I convert an SVG into a format that browser X
can display?”

Do you need to visit the Adobe SVG Viewer download page?
http://www.adobe.com/svg/viewer/install/main.html

-Rob

Rob B. http://agileconsultingllc.com
[email protected]
Skype: rob.biedenharn

Rob B. wrote:

The real question is more like: “Does my browser understand how to
render SVG?”

Or perhaps: “How can I convert an SVG into a format that browser X
can display?”

no, that isn’t the question - I have svg images displaying fine on our
website html pages with Firefox - yet when trying to use the same html
embed commands inside a Rails app, the images don’t want to display.
Maybe Rails doesnt’ see them under public/images or doesn’t like the
mime type.

This seems incredibly familiar. I had an issue where a flash embed
wasn’t
working, so I had to use send_file and explicitly set the mime type.
What
server are you using?

john-338 wrote:

no, that isn’t the question - I have svg images displaying fine on our
website html pages with Firefox - yet when trying to use the same html
embed commands inside a Rails app, the images don’t want to display.
Maybe Rails doesnt’ see them under public/images or doesn’t like the
mime type.


View this message in context:
http://www.nabble.com/-Rails--Displaying-SVG-images-tf3029447.html#a8425600
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

I have the exact same problem: I cannot serve (correctly embeded) svg
files from a rails project (instiki) using WEBrick as webserver. My
browser (firefox 2.0.0.1) asks me where to save the .svg file, instead
of showing it.

I did some testing, and using WEBrick directly (without rails around
it) DOES work correctly. I’ve been messing around in several places,
adding the mime-type “svg” => “image/svg+xml” in
/usr/lib/ruby/1.8/webrick/httputils.rb, adding it manually in
script/server to the OPTIONS variable, but nothing seems to work…

This is the working WEBrick code (with the svg mime-type still added in
my /usr/lib/ruby dir):
require ‘webrick’
include WEBrick
s = HTTPServer.new(
:Port => 2000,
:DocumentRoot => Dir::pwd + “/htdocs”
)
trap(“INT”){ s.shutdown }
s.start

s.ross wrote:

This seems incredibly familiar. I had an issue where a flash embed wasn’t
working, so I had to use send_file and explicitly set the mime type. What
server are you using?

using webbrick. How did you specifically use send_file and where did
you set mime type to get it to work ? thks