Rails 3 compatible image uploading with no dependencies? - ruby-on-rails

OK so I'm looking for a good image uploading gem that is Rails 3 compatible and has no dependencies. I was using attachment_fu, but it's Rails 3 compatibility seems to be in question. And I really wanted to use Paperclip, but it has an image majick dependency. I'm having a hard time finding other alternatives...
Stupid question #1: Shouldnt Rails have some "official" image uploading scheme thats baked into the framework? Every web app will need it at some point, and hunting around every time for some questionable third-party way of doing this gets old after awhile.
Stupid question #2: Why can't Paperclip have a no-dependency mode that doesnt make thumbnails or resize, and just stores images as they are uploaded?

As someone who has Rails with Paperclip running on both Linux, Mac and Windows, I can tell you: installing ImageMagic (or whatever spelling is) is not a problem.
In fact, my old linux hosting already had it, Mac laptop, IIRC, too. I expected some problems installing it on windows, but had to just download installer and specify correct path in rails. No problem whatsoever.
So, in your place, I would really give it a try.
edit
There's also a number of file upload plugins for Rails, but I didn't use them and can't really give advice there. Google will give you examples.

Related

Where is best place to post a Ruby on Rails Installer?

I've figured out a really simple way to install Ruby on Rails with all the latest modules on Windows & created two installers for it. One with WAMP and one without that.
With that it takes only about 5 minutes to install Ruby and Rails + WAMP. As opposed to the hours that it might take to load and compile all the modules.
I'd like to share this with as many people as possible because I think more people could learn this great language and framework, if the installation of it wasn't such a hassle!
What would be the best place where I could upload these installers and where people who look for such thing would find it?
Host your project on github, and update/inform the ROR wiki about it, which would help others know about your installations and use them

Move RefineryCMS from Local to Production

We decided to try using RefineryCMS for our current project and have run into some issues.
We began the project in a local development environment. The deadline is very quickly approaching. At first, we tried to move the project into production using a DreamHost server. There were issues with the images (Refinery uses Dragonfly), where our database dump wasn't brining any images over (or thumbnails).
We have exhausted our resources and still can't find a solution to our problem. I've done research, asked in the Google group, emailed people, and asked in the chat - no one has answered yet.
So, does anyone here have any idea what is the best solution for moving a project over from a local development environment to production?
I am sure I can't be the only person who has run into this issue...
Thanks in advance.
In case someone arrives here with this same situation (as I did), my two cents:
I've successfully migrated between servers by dumping the database and copying public/system, so this is perfectly feasible and straightforward.
At first the images were not showing neither in the backend nor in the frontend, but after a couple of hours stuck I realized the problem was that I hadn't installed ImageMagick in the new server (huge facepalm).
A quick sudo apt-get install imagemagick solved the issue.
Of course, YMMV, but I hope that helps.
I'm not sure what version of RefineryCMS you are using, or how you configured it, but unless you chose to use Amazon S3 for uploads then your Dragonfly images and resources are being stored on the file system. So in addition to that database dump, you'll probably want to look in the public/system/ folder and copy everything in the images and resources folders up to the server too.

RMagick not maintained any more?

At the RMagick repo on Github, a message was uploaded yesterday saying the main author cannot continue to maintain the project, and is looking for new people to take over. (I would certainly crash it were I to ever attempt such a job!). You can see their readme here: http://github.com/rmagick/rmagick.
In your opinion, where should a Rails 3 / Heroku / S3 app go, given that it is trying to use Paperclip for file uploads?
I think you are asking about whether to use RMagick or another alternative such as ImageScience. Is that correct? You don't actually need any of those libraries: Paperclip doesn't require them as long as the ImageMagick binaries are available on the app servers.

Ruby on Rails offline programming

I am going to be away from the internet for a few weeks and would still like to get a project done. What steps should I take to make sure I have access to the things I need (ruby and ROR) while I will be disconnected?
when offline, the following are hard to get:
gems
docs
rails expert blogs
stackoverflow ;-)
so,
gem install as much as you can
download all the railscasts
keep one or two rails book around
and find a place with internet wifi
and most importantly:
un-plug yourself 2 days before the real offline, that's called staging ;-)
If you use version control, make sure you can work offline. DVCS do this well, I've heard SVN can work offline if you have a local SVN server.
Running the Rails app on localhost will allow you to access it with your browser locally.
Apart from this it would also be nice to have documentation offline too. Download everything you can think of: Rails, Ruby, Shell, libs etc. Or use books.
Make sure you have local copies of any documentation you need (railsapi.com lets you download the Rails docs)
Make sure you have all the gems/plugins you need
This may not affect you, but it's bitten me before.
If you are using a javascript library such as jQuery, and are linking to Google's Hosted Libraries rather than a local one, you may find jQuery stops working when you are offline.
Download and link to a local copy before you go.
Get your app (in its current state) up and running on your laptop. Then shut off wireless and make sure it still goes. Don't just guess at what gems and things you'll need - make sure you see it actually run. Don't forget things like database engines and queuing servers. Then start guessing about other gems and items you might need.
Make sure that
gem server
will start up a webserver and let you browse the docs for all your installed gems.
Download every Ruby gem. All of them!
You never know when you'll need to extract EXIF data, or something.

Rails plugin Attachment_fu on Windows

I'm having problem with Rails plugin attachment_fu. On every upload, I get validation error
Size is not included in the list
I'm currently using
Rails 2.3.3
Ruby 1.8.6
The only thing I found about this problem is quite outdated discussion, which didn't help much.
Is there any solution to this problem?
I'm using attachment_fu, because I wanted to do AJAX file upload by this tutorial, but I couldn't get past the upload problem.
edit: I find only one solution that works, which is something like
def create
#image = Image.new(params[:image])
sleep 2 # for windows to catch up
#image.save ...
but I don't really like doing it this way
I think what you're really doing there is giving it time for the image processor (Rmagick or ImageScience or whatever you have hooked up) to work.
If you are are creating lots of different sizes at upload, reducing those might help.
Also, in my own experience everything runs much slower in my dev environment than it does in actual production, you may not need the hard coded delay in production.

Resources