0

I'm trying to create a web badge with user ranking. Intend for it to be used in forums where javascript might not be enabled. I have come across this

<img src='http://www.x.com/vendor.gif.aspx?id=123' style='width:50px; height:50px'/>

from How does one get about making a dynamic web badge using client side javascript?

But i'm using ruby on rails.

Anybody has an alternative method or some hints? Thanks much.

Community
  • 1
  • 1
Julien
  • 185
  • 1
  • 2
  • 15

3 Answers3

0

You don't need JavaScript. Just create a Rails action, which serves the image or whatever you want to be the badge.

<img src="/users/123/badge" ....>

You may want to ask how to create an image with Rails, but that will be a different story ;-)

(ImageMagick comes to mind)

Arsen7
  • 12,522
  • 2
  • 43
  • 60
0

You can create the image with RMagick on the server and then return it to the browser.

Here is a link to an article explaining how to create images.

You'll then need the send_data method in Rails.

I'll try and dig up a link that explains this exactly.

robzolkos
  • 2,196
  • 3
  • 30
  • 47
0

You can create an image using RMagick (uses imagemagick). Use the annotate method to put text in your image.

arnep
  • 5,971
  • 3
  • 35
  • 51