GithubHelp home page GithubHelp logo

Comments (9)

technoweenie avatar technoweenie commented on May 23, 2024

Judging by the error message, something is nil that shouldn't be. Looks like the behavior of Tempfiles changed. Send me a pull request if you find a fix that works on ruby 1.8 and 1.9. Thanks!

from attachment_fu.

lukaszsliwa avatar lukaszsliwa commented on May 23, 2024

In attachment_fu/init.rb, in method make_tmpname second argument n is nil in ruby 1.9 when I upload file but don't know why:

def make_tmpname(basename, n)
ext = nil
sprintf("%s%d-%d%s", basename.to_s.gsub(/.\w+$/) { |s| ext = s; '' }, $$, n, ext)
end

from attachment_fu.

papayaah avatar papayaah commented on May 23, 2024

was wondering if anyone has a solution to the problem? this happens on Ruby 1.9/Rails 3.0

from attachment_fu.

ivanpoznyak avatar ivanpoznyak commented on May 23, 2024

adding n ||= 0 before calling sprintf (in attachment_fu/init.rb) seems to solve the problem. I can't say if this is a "valid" fix in terms of whether it breaks something, or whether it is working in ruby 1.8.7.

from attachment_fu.

anassirk avatar anassirk commented on May 23, 2024

thanx, @ivanpoznyak. works for me.

from attachment_fu.

ippa avatar ippa commented on May 23, 2024

I've tried both fixes I've found for this issue:
n ||= 0

and
sprintf("%s%d-%s%s", basename.to_s.gsub(/.\w+$/) { |s| ext = s; '' }, $$, n, ext)
instead of
sprintf("%s%d-%d%s", basename.to_s.gsub(/.\w+$/) { |s| ext = s; '' }, $$, n, ext)

in both cases the crashing stops but something happens with my thumbnails.. they all get the same size as the original picture. Not sure if this is repeatable by others or if has something to do with my particular setup. Investigating further ...

from attachment_fu.

daronco avatar daronco commented on May 23, 2024

Another simple solution that seems to work well:

sprintf('%s%d-%d%s', File::basename(basename, ext), $$, n.to_i, ext)

Notice the:

n.to_i

At: http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions

from attachment_fu.

johnnypez avatar johnnypez commented on May 23, 2024

Did anyone get thumbnails to work after implementing the fix for this issue? I think attachment_fu is attachment_fubar on ruby 1.9 :(

from attachment_fu.

enortham avatar enortham commented on May 23, 2024

Johnypez, I upgraded my app to Ruby 1.9.2 and had to make the fix mentioned above. I was then able to upload images but they weren't being resized nor where the thumbnails being created. I realized that the processor wasn't able to load ImageMagick. After uninstalling and reinstalling rmagick I then had a seg fault and had to also reinstall ImageMagick based on http://stackoverflow.com/questions/2838307/why-is-this-rmagick-call-generating-a-segmentation-fault. Once ImageMagick was up and running fine attachment fu properly resized the images and created thumbnails under 1.9.2.

from attachment_fu.

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.