ImageKit works fine on local but doesn't work on heroku why?

46 views Asked by At
puts "Uploading image #{@game_id}"

kit = IMGKit.new(@game_url, quality: 50)
image_data = kit.to_png

obj = S3.object(File.join(@bucket_path, "#{@game_id}.png"))
obj.put(body: image_data, acl: 'public-read', content_type: 'image/png')

puts " ------------- image uploaded successfully -------------- "

This code works fine on local. When I check image it shows the correct image but when I check this by uploading on heroku it gives 0 bytes image.

Can anyone help me why this showing this type of behaviour?

1

There are 1 answers

1
Rizwan Basharat Ali On

Are you using any Cloud Storage? If not, then configure it in your project, because Heroku can access cloud storage file only, local files on your machine is not accessible by Heroku.