best way to process images already on S3 (rails) -


i have set of images on amazon s3, , i'd automatically generate thumbnails them serve on site.

i've considered cloudinary, seems i'd have copy on images cloudinary servers first. want keep them on s3.

i've considered dragonfly, seems dragonfly works files i'd upload after installing dragonfly. have uploaded files.

what's solution me? i'm in rails environment (rails 3.2).

thanks!

if it's 'set of images' it's not structured. you're better off reorganizing way store , manage images.

try paperclip.

class modelname < activerecord::base    attr_accessible :image #more here   has_attached_file :image, :styles => { :large => "450x450>", :medium => "300x300>", :thumb => "150x150>" },     :storage => :s3,     :s3_credentials => "#{rails.root}/config/s3.yml",     :path => "people/:style/:id/:filename",     :s3_protocol => "https"     def original_image_url      image.url    end     def large_image_url      image.url(:large)    end     def medium_image_url      image.url(:medium)    end     def small_image_url      image.url(:thumb)    end   #etc   end 

then assign existing image existing instance through console:

require 'uri' @instance.image = open(uri::encode(url)) @instance.save # s3 contain images in appropriate sizes in format specified above. 

since original saved, i'd advise delete 'set of images' on s3 started with, otherwise you'll duplicating them.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -