Topic: How can I call getHeight( ) and getWidth( )?

I have the following in my model and view. What should I place instead
of ????? in the view (show.html.erb)?

class Dicom < ActiveRecord::Base
        has_attached_file :photo, :styles => {:original => ["100%", :jpg]}

        def getHeight()
                uploaded_file = photo.queued_for_write[:original]
                dimensions = Paperclip::Geometry.from_file(uploaded_file)
                height = dimensions.height
                return height
        end

        def getWidth()
                uploaded_file = photo.queued_for_write[:original]
                dimensions = Paperclip::Geometry.from_file(uploaded_file)
                width = dimensions.width
                return width
                end
        end

And, in "show,html.erb":

<%= javascript_include_tag "coordinate" %>
<canvas id="draw"  height= "<%=????? %>" width="<%=????? %>" >
</canvas>
<p id="notice"><%= notice %></p>
<p>
<b> Name </b>
<%= @dicom.name %>
</p>
<p>
<b> Image </b>
</p>
<div id="image_element" style="display: none;">
<p>
<%= image_tag @dicom.photo.url , :id => 'dicom_image' %>
</p>
</div>
<%= update_page_tag do |page|
page << "drawImg();"
end
%>
<%= update_page_tag do |page|
page << "drawLine();"
end
%>
<%= link_to 'Edit', edit_dicom_path(@dicom) %>
<%= link_to 'Back', dicoms_path %>

Thanks.

Last edited by Abder-Rahman (2010-09-16 09:52:38)