delayed_paperclip
delayed_paperclip copied to clipboard
Custom styles of paperclip are not rendered in process_in_background.
I faced a problem using delayed_paperclip gem. I had already set up according to the direction on manual. When I insert the code "process_in_background" on the relevant model, custom styles of paperclip aren't generated but the original file is well uploaded to server. I confirmed that all styles of paperclip are well generated without "process_in_background".
My Gemfile is as follows:
gem 'paperclip'
gem 'paperclip-ffmpeg'
gem 'delayed_paperclip', :git => 'git://github.com/tommeier/delayed_paperclip.git', :ref => '98a8b9e0c24d24c94e2c9c39a704c1b07c5c4d6b'
gem 'daemons'
gem 'delayed_job_active_record'
gem 'delayed_job_web'
In Post model,
class Post < ActiveRecord::Base
attr_accessible :title, :attach
has_attached_file :attach, :styles => { :medium => "300x300>", :thumb => "100x100>" }
process_in_background :attach
end
in app/views/posts/_form.html.erb,
<%= form_for(@post) do |f| %>
<% if @post.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @post.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :title %><br />
<%= f.text_field :title %>
</div>
<div class="field">
<%= f.label :attach %>
<%= f.file_field :attach %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
At this context, when I submit the above form attached with some image file, :medium and :thumb custom styles are not generated at the public/system/attaches directory. But, when I comment out the line of "process_in_background" in post model, all styles are well generated.
So I think that with "process_in_background", convert function of imagemagick doesn't work. Is that right?
Is there any solution about this?
I can't replicate here. What version of rails are you using?
My development env is as follows:
- ruby 1.9.3-p194
- rails 3.2.8
I think i'm seeing an identical issue, the original image is stored just fine, but none of the styles are saved. Did you make any progress @rorlab ?
Same environment here, no errors shown in log...though i only see ONE aws store line:
[AWS S3 200 0.060147 0 retries] put_object(:acl=>"public-read",:bucket_name=>"ts-imgs-prod",:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: img1-2.jpg,:key=>"photos/201/original/img1-2.jpg")
I assume I should be seeing a line like this for EACH of my styles?
Are you using S3 / Cloud to store images?
Was, yeah, but decided to nip it in the bud by jumping over to CW since this isn't maintained actively anymore :(
@mbhnyc I'm adopting it - you can find the work in progress I'm doing over here.
Same problem here. The styles are not rendered but the worker keeps saving the instance again and again.
- ruby 1.9.3-p194
- rails 1.9.3
- paperclip 3.3.0
- paperclip-ffmpeg 0.9.1
- delayed_paperclip 2.4.5.2
Solution proposed in #67 solved the issue for me!
Thank you very much! I'll try #67.
@rorlab: Let me know if it works. I'll need to add a test for it, and get the fix released ASAP.
OMG~ My mistake! I replaced the original code of the process_delayed! method with one of #67 and then, it works wonderfully.
New process_delayed! method,
def process_delayed!
self.job_is_processing = true
self.post_processing = true
reprocess!
self.job_is_processing = false
end
in my Gemfile,
gem 'delayed_paperclip', :git => 'git://github.com/tommeier/delayed_paperclip.git', :ref => '98a8b9e0c24d24c94e2c9c39a704c1b07c5c4d6b'
Thank you very much!
I got the same error, Where should put this function (process_delayed!)?