root/vendor/file-column-0.3.1/doc/classes/FileColumn/Magick.html

Revision 2, 3.8 kB (checked in by falcon, 17 years ago)

added plugins

  • Property svn:executable set to *
Line 
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>
77If you are using file_column to upload images, you can directly process the
78images with RMagick, a ruby extension for accessing the popular imagemagick
79libraries. You can find more information about RMagick at <a
80href="http://rmagick.rubyforge.org">rmagick.rubyforge.org</a>.
81</p>
82<p>
83You can control what to do by adding a <tt>:magick</tt> option to your
84options hash. All operations are performed immediately after a new file is
85assigned to the file_column attribute.
86</p>
87<p>
88To resize the uploaded image according to an imagemagick geometry string,
89just use the <tt>:geometry</tt> option:
90</p>
91<pre>
92   file_column :image, :magick =&gt; {:geometry =&gt; &quot;800x600&gt;&quot;}
93</pre>
94<p>
95You can also create additional versions of your image, for example
96thumb-nails, like this:
97</p>
98<pre>
99   file_column :image, :magick =&gt; {:versions =&gt;
100     { &quot;thumb&quot; =&gt; &quot;50x50&quot;, &quot;medium&quot; =&gt; &quot;640x480&gt;&quot; }
101   }
102</pre>
103<p>
104These versions can later be accessed via file_column&#8217;s
105<em>suffix</em> mechanism. So if the uploaded image was named
106&quot;vancouver.jpg&quot;, you can access the additional versions like
107this:
108</p>
109<pre>
110   o.image(&quot;thumb&quot;) # produces &quot;.../vancouver-thumb.jpg&quot;
111   o.image_relative_path(&quot;medium&quot;) # produces &quot;.../vancouver-medium.jpg&quot;
112</pre>
113<p>
114The same mechanism can be used in the <tt>url_for_file_column</tt> helper:
115</p>
116<pre>
117   &lt;%= url_for_file_column &quot;entry&quot;, &quot;image&quot;, &quot;thumb&quot; %&gt;
118</pre>
119<p>
120<b>Note:</b> You&#8216;ll need the rmagick extension installed as a gem in
121order to use file_column&#8217;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>
Note: See TracBrowser for help on using the browser.