class SaucyController < ApplicationController #this is where you put styling.. require "saucy_styles" #will not create the images if filename already exists SAUCY_USE_CACHE = false #add your own authentication system to restrict public access to these methods if you need to #The default route "/:controller/:action/:id" should work fine out of the box def text image_store = RAILS_ROOT + "/public/images/saucy/" class_text = params[:id].split("_") clss= class_text[0] txt = class_text[1] text_style = SaucyTextStyles[Base64.decode64(clss)] output_path = image_store + clss+ '_' + txt + ".png" if !SAUCY_USE_CACHE || !(FileTest.exists? output_path) font_store = RAILS_ROOT + '/vendor/plugins/saucy/fonts/' img = Saucy.render_text(Base64.decode64(txt), text_style, font_store) img = Saucy.render_shadow(img, text_style[:shadow]) if(text_style[:shadow]) img.write(output_path) end send_file output_path, :type => 'image/jpeg', :disposition => 'inline' end def gradient image_store = RAILS_ROOT + "/public/images/saucy/" clss= params[:id] gradient_style = SaucyGradientStyles[Base64.decode64(clss)] output_path = image_store + clss + ".png" if !SAUCY_USE_CACHE || !(FileTest.exists? output_path) texture_store = RAILS_ROOT + '/vendor/plugins/saucy/textures/' img = Saucy.render_gradient(gradient_style, texture_store) img.write(output_path) end send_file output_path, :type => 'image/jpeg', :disposition => 'inline' end end