IMGKit icon indicating copy to clipboard operation
IMGKit copied to clipboard

not working with url source referring to application

Open bharthur opened this issue 13 years ago • 2 comments

--following is what i'm trying to do......

filename = current_user.slug + "-" + Time.now.to_i.to_s kit = IMGKit.new("http://127.0.0.1:3000/snapshot/#{current_user.slug}") img = kit.to_img(:png) temp_dir = Rails.root.join('tmp') Dir.mkdir(temp_dir) unless Dir.exists?(temp_dir) file = Tempfile.new([filename, 'png'], temp_dir, :encoding => 'ascii-8bit') file.write(img) file.flush current_user.shares.create!(share_type: "image", snap: file) file.unlink

--when the url source is "http://127.0.0.1:3000" or my staging app url "http://recroup-stage.herokuapp.com/ " it goes into an endless loop...

--when i do the same thing in rails console it works but not in the app

--please let me know what i'm doing wrong here..

bharthur avatar Dec 17 '12 15:12 bharthur

Are you using webrick server? It can serve only 1 request...

Try using unicorn server with 2 or more workers

dmilisic avatar Nov 06 '13 11:11 dmilisic

You should consider putting this in something like a resque job, that's what I did and it seem to work fine.

davidpatters0n avatar Aug 28 '14 13:08 davidpatters0n