ruby on rails - Paperclip Processor Operate on S3 -
i trying create custom paperclip::processor
integrates external web service (the processor call web service whenever new file uploaded). external service needs file present in s3 , handle uploading processed versions s3 automatically.
can done using custom paperclip::processor
or should done activerecord callback? if paperclip::processor
work, best way trigger upload? ideally i'd processor, requirement original file must uploaded s3 first. have taken @ using after_create
calls, seems conflict after_create
used in paperclip. thanks.
you can create local copy of file. if it's on s3 downloaded.
tmp_file = @model.attached_file.to_file => tempfile<...>
you can operations on tempfile. when you're don:
@model.attached_file = tmp_file @model.save
edit: misread question. can use before_post_process
, after_post_process
hooks perform tasks before or after file processed.
class model < ar::base has_attached_file :avatar after_post_process :ping_webservice private def ping_webservice # magic here. end end
Comments
Post a Comment