lib/simple_captcha/image.rb in glebtv-simple_captcha-0.3.1 vs lib/simple_captcha/image.rb in glebtv-simple_captcha-0.4.1

- old
+ new

@@ -70,17 +70,19 @@ params = ImageHelpers.image_params_from_color(SimpleCaptcha.image_color).dup end params << "-size #{SimpleCaptcha.image_size} xc:transparent" params << "-gravity \"Center\"" + psz = SimpleCaptcha.pointsize if params.join(' ').index('-pointsize').nil? - params << "-pointsize #{SimpleCaptcha.pointsize}" + params << "-pointsize #{psz}" end + dst = Tempfile.new(RUBY_VERSION < '1.9' ? 'simple_captcha.png' : ['simple_captcha', '.png'], SimpleCaptcha.tmp_path) dst.binmode text.split(//).each_with_index do |letter, index| - i = -60 + (index*25) + rand(-6..6) - params << "-draw \"translate #{i},#{rand(-6..6)} skewX #{rand(-15..15)} gravity center text 0,0 '#{letter}'\" " + i = -(1.5 * psz) + (index * 0.75 * psz) + rand(-3..3) + params << "-draw \"translate #{i},#{rand(-3..3)} skewX #{rand(-15..15)} gravity center text 0,0 '#{letter}'\" " end params << "-wave #{amplitude}x#{frequency}" (1..10).each do |i|