| 1 | <?xml version="1.0" encoding="iso-8859-1"?> |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 4 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 5 | |
|---|
| 6 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 7 | <head> |
|---|
| 8 | <title>Module: FileColumn::Magick</title> |
|---|
| 9 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
|---|
| 10 | <meta http-equiv="Content-Script-Type" content="text/javascript" /> |
|---|
| 11 | <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> |
|---|
| 12 | <script type="text/javascript"> |
|---|
| 13 | // <![CDATA[ |
|---|
| 14 | |
|---|
| 15 | function popupCode( url ) { |
|---|
| 16 | window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | function toggleCode( id ) { |
|---|
| 20 | if ( document.getElementById ) |
|---|
| 21 | elem = document.getElementById( id ); |
|---|
| 22 | else if ( document.all ) |
|---|
| 23 | elem = eval( "document.all." + id ); |
|---|
| 24 | else |
|---|
| 25 | return false; |
|---|
| 26 | |
|---|
| 27 | elemStyle = elem.style; |
|---|
| 28 | |
|---|
| 29 | if ( elemStyle.display != "block" ) { |
|---|
| 30 | elemStyle.display = "block" |
|---|
| 31 | } else { |
|---|
| 32 | elemStyle.display = "none" |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | return true; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | // Make codeblocks hidden by default |
|---|
| 39 | document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) |
|---|
| 40 | |
|---|
| 41 | // ]]> |
|---|
| 42 | </script> |
|---|
| 43 | |
|---|
| 44 | </head> |
|---|
| 45 | <body> |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | <div id="classHeader"> |
|---|
| 50 | <table class="header-table"> |
|---|
| 51 | <tr class="top-aligned-row"> |
|---|
| 52 | <td><strong>Module</strong></td> |
|---|
| 53 | <td class="class-name-in-header">FileColumn::Magick</td> |
|---|
| 54 | </tr> |
|---|
| 55 | <tr class="top-aligned-row"> |
|---|
| 56 | <td><strong>In:</strong></td> |
|---|
| 57 | <td> |
|---|
| 58 | <a href="../../files/lib/magick_file_column_rb.html"> |
|---|
| 59 | lib/magick_file_column.rb |
|---|
| 60 | </a> |
|---|
| 61 | <br /> |
|---|
| 62 | </td> |
|---|
| 63 | </tr> |
|---|
| 64 | |
|---|
| 65 | </table> |
|---|
| 66 | </div> |
|---|
| 67 | <!-- banner header --> |
|---|
| 68 | |
|---|
| 69 | <div id="bodyContent"> |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | <div id="contextContent"> |
|---|
| 74 | |
|---|
| 75 | <div id="description"> |
|---|
| 76 | <p> |
|---|
| 77 | If you are using file_column to upload images, you can directly process the |
|---|
| 78 | images with RMagick, a ruby extension for accessing the popular imagemagick |
|---|
| 79 | libraries. You can find more information about RMagick at <a |
|---|
| 80 | href="http://rmagick.rubyforge.org">rmagick.rubyforge.org</a>. |
|---|
| 81 | </p> |
|---|
| 82 | <p> |
|---|
| 83 | You can control what to do by adding a <tt>:magick</tt> option to your |
|---|
| 84 | options hash. All operations are performed immediately after a new file is |
|---|
| 85 | assigned to the file_column attribute. |
|---|
| 86 | </p> |
|---|
| 87 | <p> |
|---|
| 88 | To resize the uploaded image according to an imagemagick geometry string, |
|---|
| 89 | just use the <tt>:geometry</tt> option: |
|---|
| 90 | </p> |
|---|
| 91 | <pre> |
|---|
| 92 | file_column :image, :magick => {:geometry => "800x600>"} |
|---|
| 93 | </pre> |
|---|
| 94 | <p> |
|---|
| 95 | You can also create additional versions of your image, for example |
|---|
| 96 | thumb-nails, like this: |
|---|
| 97 | </p> |
|---|
| 98 | <pre> |
|---|
| 99 | file_column :image, :magick => {:versions => |
|---|
| 100 | { "thumb" => "50x50", "medium" => "640x480>" } |
|---|
| 101 | } |
|---|
| 102 | </pre> |
|---|
| 103 | <p> |
|---|
| 104 | These versions can later be accessed via file_column’s |
|---|
| 105 | <em>suffix</em> mechanism. So if the uploaded image was named |
|---|
| 106 | "vancouver.jpg", you can access the additional versions like |
|---|
| 107 | this: |
|---|
| 108 | </p> |
|---|
| 109 | <pre> |
|---|
| 110 | o.image("thumb") # produces ".../vancouver-thumb.jpg" |
|---|
| 111 | o.image_relative_path("medium") # produces ".../vancouver-medium.jpg" |
|---|
| 112 | </pre> |
|---|
| 113 | <p> |
|---|
| 114 | The same mechanism can be used in the <tt>url_for_file_column</tt> helper: |
|---|
| 115 | </p> |
|---|
| 116 | <pre> |
|---|
| 117 | <%= url_for_file_column "entry", "image", "thumb" %> |
|---|
| 118 | </pre> |
|---|
| 119 | <p> |
|---|
| 120 | <b>Note:</b> You‘ll need the rmagick extension installed as a gem in |
|---|
| 121 | order to use file_column’s rmagick integration. |
|---|
| 122 | </p> |
|---|
| 123 | |
|---|
| 124 | </div> |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | </div> |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | </div> |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | <!-- if includes --> |
|---|
| 134 | |
|---|
| 135 | <div id="section"> |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | |
|---|
| 144 | <!-- if method_list --> |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | </div> |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | <div id="validator-badges"> |
|---|
| 151 | <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> |
|---|
| 152 | </div> |
|---|
| 153 | |
|---|
| 154 | </body> |
|---|
| 155 | </html> |
|---|