Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Cory Logan's Profile

GitHub User: counterbeing


Comments by Cory Logan


I'd like to second that. I spent an hour fiddling with Taps. I was done with my intended task five minutes after hearing this post about valkyrie. Just lovely. Thanks!


An update! I got very very frustrated, and tried everything over again on a new machine. I went back to Rmagick and it worked this time. The key thing seemed to be with my setup. I'm not sure specifically what, but it had something to do with Ghostscript and/or MacPorts. Removing macports, reinstalling imagemagick, reinstalling rmagick, reinstalling ghostcript finally did it for me!



Hey, Great tutorial, but I'm running into an issue. Firstly RMagick didn't work for me. For some reason, every time without fail, it brought down my rails server when the method that does resizing was called. I found a bunch of people with the same issue, but none of the fixes, which generally included reinstalling both RMagick and Imagemagick, worked for me. The solution that got me a step further was switching to MiniMagick. Now images resize and are saved, but the next step is moving on to the actual cropping, this is now where I'm up against a new issue.

This was taken from my pdf_uploader.rb (despite the name PDF I'm currently only using jpegs just to avoid any potential difficulties there). This is my crop method, which looks pretty similar to the one in the tutorial. Someone on stack overflow also had an issue with the way your crop method worked and suggested I try something more like this:

  def crop
    if model.crop_x.present?
        img =
        x = model.crop_x.to_i
        y = model.crop_y.to_i
        w = model.crop_w.to_i
        h = model.crop_h.to_i
        img.crop(x, y, w, h)

This doesn't work for me either even though I'm trying to explicitly edit the file. The reason has everything to do with "model.pdf.path" which I was told should do the trick... When I inspect "model.pdf.path" it prints out a tmp directory, rather than the path to where the file actually lives... This results in a big fat show stopping error, and no crop.

Errno::ENOENT in PiecesController#update

No such file or directory - /var/folders/dF/dFNM2+Y7FVScn4+OxVHKOU+++TI/-Tmp-/mini_magick20111208-45803-1027dqf.png
Rails.root: /Users/cory/Documents/Projects/TickiWiki

Application Trace | Framework Trace | Full Trace
app/uploaders/pdf_uploader.rb:78:in crop'
app/controllers/pieces_controller.rb:107:in block in update'



This leads me to a few questions:
1. Why, what did I do to deserve this?
2. How can I get the correct value?
3. Will the correct value even make it work?
4. Is there a better way to do this?
5. Why can't I code as quickly and with as few mistakes as Ryan Bates in a RailsCast?

Anyway, this n00b would love any suggestions anyone has. Thanks!