سؤال

I am using imgkit gem in my application to take snapshot of current page controller code is

kit = IMGKit.new(render_to_string)
t = kit.to_img(:png) 
file_path = '/home/myapp/file.png'
file = kit.to_file(file_path)

working fine(image save in myapp/file.png ).

Now my question

  • each time this method will overwrite file.png that i don't want
  • how can i display those saved images(suppose i give the saving path in images folder in my root app directory)

hope i explain my problem clearly, i am not using S3 for storing instead i am using my local machine

i am using https://github.com/csquared/IMGKit for my reference

هل كانت مفيدة؟

المحلول

file_path = "/home/myapp/#{Time.now}file.png" should do it

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top