The dreaded “No such file to load — rubygems (LoadError)” came to me today. I recently installed some Python stuff, and I ran OS X Software Update. Either one could have been the culprit, but in this case it was the Python installation. Continue reading →
Entries Tagged 'RMagick' ↓
OS X, suddenly: “No such file to load — rubygems (LoadError)” WTF?!
September 3rd, 2007 — Beginning Programming, Linux, OS X, Programming, RMagick, Rails, Ruby, Software, UNIX
Yep, file_column is the way to go for now!
July 27th, 2007 — Programming, RMagick, Rails, Ruby, Software, Web Graphics
Yep, file_column IS the way to go for now. RMagick works like magic with it. What’s more, file_column does things basically the way I wanted to do them, storing things in the file system in a logical, directory heirarchy. It doesn’t use RESTful routes for the directories, at least not with the setup I’ve got, though I’m sure it could. Regardless, REST is not a priority at the moment; file_column works! So now I’m on to other things with my app!
The one thing I did notice, is that file_column seems to make it’s calls to RMagick via the model rather than the controller. This is quite significant I think. This indicates to me, something I was already suspecting: RMagick calls work better from the model than from the controller.
I’ll just have to confirm that theory at a later date, when I try to recreate my own upload & resize code.
Rails File Uploads: file_column !!!
July 27th, 2007 — Programming, RMagick, Rails, Ruby, Software, Web Graphics
After much consternation with writing my own file upload code, I have settled with the file_column plugin for Rails.
Why? Well, my uploads were working fine, but I was having weird problems with my RMagick resizing results.
I will not say don’t do it yourself. I say do it, and I will still try to write my own upload and resize code, but I need a stop-gap measure to get my app going for now. Definitely writing your own is the best way to learn and understand what’s going on, and that is something you should do!
I have to say, that file_column should not be the first thing you attempt if you’re still new at Rails. Make sure you understand how the CRUD features generated by scaffold code work, and that you can hand code your own (even by cheating and looking at other code, nothing wrong with that, if you understand it) and then you can focus on file_column. Like all plugins and all code written by somebody else, it has a particular maddness (er.. method..) that you have to stick to. That said, file_column keeps it pretty simple and straight forward for you.
Great stuff.
Couldn’t get attachment_fu to work… (> <;)
Rails is Bailing out in RMagick…
July 25th, 2007 — CMS, ImageMagick, Programming, RMagick, Rails, Ruby, Web Graphics
Maybe I’m a fool for putting my RMagick into a Rails controller and not a model. We’ll see, later. After I adjust things a bit and try the model approach.
Here the code as a stand alone script:
# RMagick Test
require 'rubygems'
require 'rmagick'
include Magick
puts "Enter the name of the file to thumb:"
image_to_alter = gets.chomp
img = Image.read(image_to_alter)[0]
thumbnail_height = 100
thumbnail_width = 100
geometry_obj = Geometry.new(thumbnail_width, thumbnail_height, nil, nil, '!')
chg_geom_img = img.change_geometry(geometry_obj) {|cols, rows, image| image.resize(cols, rows)}
chg_geom_img_name = 'thumbnail_' + image_to_alter#@basename_of_f
chg_geom_img.write(chg_geom_img_name)
Here is the original image:

Here is the image after resizing with my Ruby script:
![]()
Here is the version that was resized using almost the identical code, from within a Rails app:
![]()
Screwy, huh?
Any tips/advice very welcome!
Waylaid by RMagick Woe
July 24th, 2007 — ImageMagick, OS X, Programming, RMagick, Rails, Ruby, Software, Web Graphics
My Rails app adventures have ground to halt finally. The app itself is still viable, though filled with code that needs refactoring for sure. But the image processing is screwed for now. At least on OS X. I’m going to have to move on to other aspects of the app for now.
Simply resizing images in RMagick results in stuff like this far too often to be reliable for now.

It’s not drastic in this example, but it’s not acceptable either, the grey at the bottom shouldn’t be there at all. It’s not in the original image. Resizing an image to a smaller size certainly shouldn’t introduce this stuff.
Any help is welcome…