<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - How can I call getHeight( ) and getWidth( )?]]></title>
		<link>http://railsforum.com/viewtopic.php?id=40906</link>
		<description><![CDATA[The most recent posts in How can I call getHeight( ) and getWidth( )?.]]></description>
		<lastBuildDate>Thu, 16 Sep 2010 13:51:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[How can I call getHeight( ) and getWidth( )?]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=130965#p130965</link>
			<description><![CDATA[<p>I have the following in my model and view. What should I place instead<br />of ????? in the view (show.html.erb)?</p><p>class Dicom &lt; ActiveRecord::Base<br />&nbsp; &nbsp; &nbsp; &nbsp; has_attached_file :photo, :styles =&gt; {:original =&gt; [&quot;100%&quot;, :jpg]}</p><p>&nbsp; &nbsp; &nbsp; &nbsp; def getHeight()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uploaded_file = photo.queued_for_write[:original]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dimensions = Paperclip::Geometry.from_file(uploaded_file)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height = dimensions.height<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return height<br />&nbsp; &nbsp; &nbsp; &nbsp; end</p><p>&nbsp; &nbsp; &nbsp; &nbsp; def getWidth()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; uploaded_file = photo.queued_for_write[:original]<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dimensions = Paperclip::Geometry.from_file(uploaded_file)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width = dimensions.width<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return width<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br />&nbsp; &nbsp; &nbsp; &nbsp; end</p><p>And, in &quot;show,html.erb&quot;:</p><p>&lt;%= javascript_include_tag &quot;coordinate&quot; %&gt;<br />&lt;canvas id=&quot;draw&quot;&nbsp; height= &quot;&lt;%=????? %&gt;&quot; width=&quot;&lt;%=????? %&gt;&quot; &gt;<br />&lt;/canvas&gt;<br />&lt;p id=&quot;notice&quot;&gt;&lt;%= notice %&gt;&lt;/p&gt;<br />&lt;p&gt;<br />&lt;b&gt; Name &lt;/b&gt;<br />&lt;%= @dicom.name %&gt;<br />&lt;/p&gt;<br />&lt;p&gt;<br />&lt;b&gt; Image &lt;/b&gt;<br />&lt;/p&gt;<br />&lt;div id=&quot;image_element&quot; style=&quot;display: none;&quot;&gt;<br />&lt;p&gt;<br />&lt;%= image_tag @dicom.photo.url , :id =&gt; &#039;dicom_image&#039; %&gt;<br />&lt;/p&gt;<br />&lt;/div&gt;<br />&lt;%= update_page_tag do |page|<br />page &lt;&lt; &quot;drawImg();&quot;<br />end<br />%&gt;<br />&lt;%= update_page_tag do |page|<br />page &lt;&lt; &quot;drawLine();&quot;<br />end<br />%&gt;<br />&lt;%= link_to &#039;Edit&#039;, edit_dicom_path(@dicom) %&gt;<br />&lt;%= link_to &#039;Back&#039;, dicoms_path %&gt;</p><p>Thanks.</p>]]></description>
			<author><![CDATA[dummy@example.com (Abder-Rahman)]]></author>
			<pubDate>Thu, 16 Sep 2010 13:51:24 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=130965#p130965</guid>
		</item>
	</channel>
</rss>
