Hi guys,
I am new to ruby. I have the following problem.
I have a rendering engine that will take a svg and a set of params and
return a PNG image.
If I use curl on the command line passing the SVG it returns the image
as PNG and everything looks good.
I am trying to issue the same command using CURB but I have no idea how
to get the binary body.
I tried the following code:
def get_product_image_curl(svg, image_name, w, h, region,
alignment)
preview_url
"http://#{APP_CONFIG[''preview_server'']}/merchandise/#{image_name}?region=name:#{region},w:#{w},h:#{h},a:#{alignment}"
c = Curl::Easy.new(preview_url)
svg = URI.escape(svg,
Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
c.http_post(Curl::PostField.content(''design'', svg,
''application/x-www-form-urlencoded''))
return c.body_str
end
The body returns empty
The curls that works (same svg)
curl -v --data-urlencode design-PkfQWh9sa7aExp/uPcdT9w@public.gmane.org
"http://<render
server>/merchandise/344_480x480_Front.png?region=name:FrontCenter,w:23,h:63,a:TopCenter"> prod.png
Any idea how to get the body our of the response?
Thanks in advance
Dalmer Azevedo
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.