Comments (9)
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.
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.
was wondering if anyone has a solution to the problem? this happens on Ruby 1.9/Rails 3.0
from attachment_fu.
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.
thanx, @ivanpoznyak. works for me.
from attachment_fu.
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.
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.
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.
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)
- Rails 3 HOT 6
- displaying pdf attachment inline, in the view (problem with browsers on Windows) HOT 2
- attachment_fu + factory_girl HOT 2
- batch import does not create thumbnails and does not take into account MetaModel attachment options
- Cannot upload file from ActionController::TestUploadedFile in JRuby HOT 3
- Switching between different machines HOT 1
- S3/Cloud Creates wrong public path when using separate thumbnail class HOT 1
- Cloudfile cdn down cause passenger completely to freeze HOT 2
- Core Image Processor causes segmentation faults on OS X 10.6.x - 64bit.
- Validating image dimensions before save
- Word 2010 view
- Solved Rails 3.0.3 temp_file size problem. Maybe this needs a more solid fix HOT 1
- Server Setting Missing In Config File
- Form with "f.file_field :uploaded_data" causes 500 internal server error HOT 3
- TypeError (can't convert nil into Integer): HOT 1
- In my production machine thumbnils arte not getting created
- RAILS_ROOT is gone in rails 3.1.0 HOT 2
- test do not run without being inside a rails project
- Error when attempting to install attachment_fu using bundler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from attachment_fu.