Current time: 04-18-2014, 06:50 AM Hello There, Guest! (LoginRegister)

Post Reply 
Rmagick dead on resize process
10-22-2007, 05:48 PM
Post: #1
Rmagick dead on resize process
Hi, this is my first post Smile.

Problem: I can't resize any image with Rmagick in rails application.

I soppose:
1 - Rmagick eats a lot of memory
and 2 - FCGI (or DH policies) kill the process to protect the others users of the shared server.

I do:
- make an RoR application to upload images. A simple model with post and many images.
- create a new domain user and assign this application.
- freeze gems
- change .htaccess[1] and fcgi distpacher[2]
- deploy an aplication with svn and capistrano.

My Report:
- The application works fine, fast, except the image uploading, it crash!

Solutions:
- Drop out Rmagick and install other gem for image manipulation. ImageScience for example. But Rmagick is the most complete tool.
- Extend my account to http://www.dreamhostps.com/ with >200MB of RAM.
- Find other job where they do not have technology involved such as goats keeper Smile [joke]

Question:
Someone could successfully implement an application to upload images?

Thanks in advance!!,
Dario

Source:

[1]
AddHandler fastcgi-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

[2] -> from http://gabrito.com/post/ruby-on-rails-dreamhost-plugin
NOTE: If not added this script or similar, most of the applications don't work or run veeeeery slow.

#!/usr/bin/ruby1.8

require File.dirname(__FILE__) + “/../config/environment“
require ‘fcgi_handler‘

class RailsFCGIHandler
private
def busy_exit_handler(signal)
dispatcher_log :info, “busy: asked to terminate during request signal #{signal}, deferring!“
@when_ready = :exit
end

# Dreamhost sends the term signal and if we’re handling a request defer it
def term_process_request(cgi)
install_signal_handler(’TERM‘,method(:busy_exit_handler).to_proc)
Dispatcher.dispatch(cgi)
rescue Exception => e # errors from CGI dispatch
raise if SignalException === e
dispatcher_error(e)
ensure
install_signal_handler(’TERM‘, method(:exit_now_handler).to_proc)
end
alias_method :process_request, :term_process_request
end

RailsFCGIHandler.process!

Dario E. Brozzi
Find all posts by this user
Quote this message in a reply
11-12-2007, 08:47 PM
Post: #2
Rmagick dead on resize process
The problem is in File_column, in Gravity variable for crop functionality.

Solution:
"Open up /vendor/plugins/file_column/lib/magick_file_column.rb, and remove the 'true' parameter to the img.crop function call on line 90"

Extracted from original solution by bentlegen's comment[1]

[1]File_column Plugin Broken : http://wiki.dreamhost.com/Talk:Ruby_on_Rails

Dario E. Brozzi
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: