Git Product home page Git Product logo

Comments (6)

ScotterC avatar ScotterC commented on August 16, 2024

Thanks for the issue. Can you post your full paperclip and delayed_paperclip configuration?

This sounds similar to this. Does it work properly without delayed paperclip?

from delayed_paperclip.

walterdavis avatar walterdavis commented on August 16, 2024

I'll try to do that later today. I can't see how it would work incorrectly without delayed paperclip -- if the file is uploaded and the asset is saved in that same process, then the missing image wouldn't be linked at all.

Walter

On Nov 13, 2013, at 10:33 AM, Scott Carleton wrote:

Thanks for the issue. Can you post your full paperclip and delayed_paperclip configuration?

This sounds similar to this. Does it work properly without delayed paperclip?


Reply to this email directly or view it on GitHub.

from delayed_paperclip.

tombruijn avatar tombruijn commented on August 16, 2024

I'm having the same issue and it looks like it could only happen in delayed_paperclip. In my config the only thing referencing the missing files is delayed_paperclip.

This is my config:

class MediaBlock < ActiveRecord::Base

  # ...

  has_attached_file :cover,
    styles: { thumb: "50x50>", small: "480x240^", large: "480x480^" },
    convert_options: { small: "-gravity center -crop 440x240+0+0 +repage" }
  process_in_background :cover, processing_image_url: "/media-missing/:style/missing.png"

  # ...

end

I though it was a conflict of the media directory at first, but renaming it to media-missing and having the directory still clear is kind of strange. My media-missing directory contains missing images for the thumb, small, large and original styles. When it is cleared during the job the thumb, small and large directory are cleared while the original directory is removed completely.

I looked through the delayed_paperclip codebase, but couldn't find a place where this could easily happen accidentally. Maybe it's paperclip throwing them away thinking these files were previous uploads and then replacing them with new ones throwing the old ones away?

Note: I have paperclip configured with S3, as in the other issue, using the fog gem, but this happens in development (on my machine, without S3 configured) as well.

from delayed_paperclip.

walterdavis avatar walterdavis commented on August 16, 2024

This was what I surmised as well.

Walter

On Dec 2, 2013, at 9:52 AM, Tom de Bruijn wrote:

Maybe it's paperclip thinking these files are uploads and then replaced with new one throwing the old ones away?

from delayed_paperclip.

tombruijn avatar tombruijn commented on August 16, 2024

Sorry walter, thought you never tried it with the processing_image_url.
Monkey patched it for now with this in my app:

def cover_url(style = :original)
  if cover_processing?
    ActionController::Base.helpers.asset_path("media-missing/#{style}/missing.png")
  else
    cover.url(style)
  end
end

media.cover.url(:thumb) => media.cover_url(:thumb)

So I'm not using the processing_image_url or missing images anymore.

from delayed_paperclip.

walterdavis avatar walterdavis commented on August 16, 2024

This looks very useful. Thanks for the update. I ended up using the processing_image_url without the missing images in base paperclip, and that worked as well (although I lost the desired behavior of missing_url). Your way looks to be more correct for my purposes.

It really does seem that paperclip believes that the missing image is the real file owned by the model, and so as in a normal update, deletes it before attaching the delayed processed version. On the production app that I'm aiming this toward, we already use the keep deleted assets behavior, so it might still work there, but I think your technique is more expressive and thus more likely to land when I implement this feature for real.

from delayed_paperclip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.