# Rmagick wouldn't load on server for windows

**URL:** <https://www.ruby-forum.com/t/rmagick-wouldnt-load-on-server-for-windows/151997>\
**Category:** Rails\
**Created:** [October 28, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/rmagick-wouldnt-load-on-server-for-windows/151997 "2008-10-28T20:23:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flychunjae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@flychunjae](https://www.ruby-forum.com/u/flychunjae)\
**Post date:** [October 28, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/rmagick-wouldnt-load-on-server-for-windows/151997/1 "2008-10-28T20:23:31Z")

</div>

In windows, i’m trying to load rmagick for my app so i put

require ‘RMagick’

in environment.rb but the server wouldn’t start and it gives me this  
error:

C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/ext/RMagick2.so  
(LoadError)  
from C:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:32:in  
`require' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in`require’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active\_support/dependencies.rb:355:in  
`new_constants_in' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in`require’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/lib/RMagick.rb:11  
from C:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:32:in  
`gem_original_require' from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in`require’  
from  
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active\_support/dependencies.rb:510:in  
`require' ... 18 levels... from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
from ./script/server:3  
from -e:4:in `load’  
from -e:4

the file is there but it won’t load…any advice? ^\_^!

---

<div class="post-metadata">

**Author:** ![flychunjae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@flychunjae](https://www.ruby-forum.com/u/flychunjae)\
**Post date:** [October 29, 2008, 3:11am UTC](https://www.ruby-forum.com/t/rmagick-wouldnt-load-on-server-for-windows/151997/2 "2008-10-29T03:11:38Z")

</div>

Was RMagick2.so built under windows?

On Oct 28, 9:23 am, Richard Y. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![flychunjae](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/3ab097/32.png) [@flychunjae](https://www.ruby-forum.com/u/flychunjae)\
**Post date:** [October 29, 2008, 3:18am UTC](https://www.ruby-forum.com/t/rmagick-wouldnt-load-on-server-for-windows/151997/3 "2008-10-29T03:18:24Z")

</div>

yes i’m running on windows at the moment.

well i got the rmagick to load and put the

required “Rmagick” in the environment.rb

but when i try to post something with image it rolls back and does not  
post. i followed the guide from the advanced rails recipes and just  
changed the names around but bleh.

the view:

\<% form\_for(@item, :html =\> { :multipart =\> true }) do |f| %\>  
\<%= error\_messages\_for :item, :image %\>

\<%= f.label :title %\>  
 \<%= f.text\_field :title %\>

\<%= f.label :description %\>  
 \<%= f.text\_area :description %\>

\<%= label :item, :image %\> \<%= file\_field\_tag :image\_file %\> We accept JPEG, GIF, or PNG files up to 500 KB.

\<%= f.label :price %\>  
\<%= f.text\_field :price %\>

\<%= f.submit "Create" %\>

\<% end %\>

controller

def new  
@item = Item.new

```
respond_to do |format|
  format.html # new.html.erb
  format.xml { render :xml => @item }
end

```

end

# GET /items/1/edit

def edit  
@item = Item.find(params[:id])  
end

# POST /items

# POST /items.xml

def create  
@item = Item.new(params[:item])  
@image = Image.new(:uploaded\_data =\> params[:image\_file])

```
@service = ItemService.new(@item, @image)

respond_to do |format|
  if @service.save
    flash[:notice] = 'Item was successfully created.'
    format.html { redirect_to(@item) }
    format.xml { render :xml => @item,
                         :status => :created,
                         :location => @item }
  else
    format.html { render :action => "new" }
    format.xml { render :xml => @item.errors,
                         :status => :unprocessable_entity }
  end
end

```

items\_helper.rb

module ItemsHelper

def image\_for(item, size = :medium)  
if item.image  
image\_image = item.image.public\_filename(size)  
link\_to image\_tag(image\_image), item.image.public\_filename  
else  
image\_tag(“blank-image-#{size}.png” )  
end  
end

end

item\_service.rb

class ItemService

attr\_reader :item, :image

def initialize(item, image)  
@item = item  
@image = image  
end

def save  
return false unless valid?  
begin  
Image.transaction do  
if @image.new\_record?  
@item.image.destroy if @item.cover  
@image.item = @item  
@image.save!  
end  
@item.save!  
true  
end  
rescue  
false  
end  
end

def valid?  
@item.valid? && @image.valid?  
end

def update\_attributes(item\_attributes, image\_file)  
@item.attributes = item\_attributes  
unless image\_file.blank?  
@image = Image.new(:uploaded\_data =\> image\_file)  
end  
save  
end

end

development.log

Processing ItemsController#create (for 127.0.0.1 at 2008-10-28 22:08:46)  
[POST]  
Session ID:  
BAh7BzoMY3NyZl9pZCIlMDc3Y2M3ZGVjN2U5OWFhMGY5ZDUzMTQ1ZTRlYTc1  
ZGEiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh  
c2h7AAY6CkB1c2VkewA=–4332f39dc3fdbc9fc0d4d317ca2c57f1481d87df  
Parameters:  
{“image\_file”=\>#\<File:C:/Users/HYUKYO~1/AppData/Local/Temp/CGI6348-3\>,  
“commit”=\>“Create”,  
“authenticity\_token”=\>“e798b2552991572d78d139f4268655e69369ee32”,  
“action”=\>“create”, “controller”=\>“items”, “item”=\>{“title”=\>“adf”,  
“price”=\>“23”, “description”=\>“asdfasdf”}}  
e[4;35;1mItem Columns (0.004000)e[0m e[0mSHOW FIELDS FROM  
`items`e[0m  
e[4;36;1mImage Columns (0.004000)e[0m e[0;1mSHOW FIELDS FROM  
`images`e[0m  
e[4;35;1mSQL (0.001000)e[0m e[0mBEGINe[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mROLLBACKe[0m  
Rendering template within layouts/items  
Rendering items/new  
Completed in 0.23000 (4 reqs/sec) | Rendering: 0.00400 (1%) | DB:  
0.00900 (3%) | 200 OK [[http://localhost/items](http://localhost/items)]
