title: Supplying a variable string to model for Paperclip Imagemagik resizing
body: <p>I'm using paperclip to upload some images which get resized. One of which I want to be cropped one of five ways... Anyway, I worked out what the strings to crop should all look like, by changing them by hand, but now i need to make that dynamic so that paperclip can crop based upon what the user wants... </p>
  
  <p>The problem is that I'm getting</p>
  
  <pre><code>undefined local variable or method `params' for #&lt;Class:0x00000105b228d8&gt;
  </code></pre>
  
  <p>I feel pretty sure that this is because I'm attempting to bend rails to my will. Anyway, I think it's pretty clear what I'm trying to do... Just supply the crop_geometry_thumb variable to convert_options... Where should I actually be putting this logic that my model will be able to find it?</p>
  
  <pre><code>class Asset &lt; ActiveRecord::Base
     if  params[:crop_geometry] == "bottom"
       crop_geometry_thumb = "-crop 200x100+0+100 -scale 100x100"
     elsif  params[:crop_geometry] == "top"
       crop_geometry_thumb = "-crop 200x100+0+0 -scale 100x100"
     elsif  params[:crop_geometry] == "left"
       crop_geometry_thumb = "-crop 100x200+0+100 -scale 100x100"
     elsif  params[:crop_geometry] == "right"
       crop_geometry_thumb = "-crop 100x200+100+0 -scale 100x100"
     else
       crop_geometry_thumb = "-scale 100x100"
     end
  
    belongs_to :piece
    has_attached_file :asset, :styles =&gt; {
      :large =&gt; ['700x700', :jpg], 
      :medium =&gt; ['300x300&gt;', :jpg], 
      :thumb =&gt; ["200x200&gt;", :jpg]},
      :convert_options =&gt; {:thumb =&gt; crop_geometry_thumb}, ### supply a string from above... FAIL :(
      :path =&gt; ":id/:style/:filename",
      :storage =&gt; :s3,
      :s3_credentials =&gt; "#{RAILS_ROOT}/config/s3.yml",
      :s3_permissions =&gt; :private,
      :url =&gt; ':s3_domain_url'
  end
  </code></pre>