diff options
author | Derek Jones <derek.jones@ellislab.com> | 2011-07-02 00:56:50 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2011-07-02 00:56:50 +0200 |
commit | 37f4b9caa02783e06dd7c5318200113409a0deb1 (patch) | |
tree | 314bd87831a09913cbbfd1ffe1447b3c38b394c5 /user_guide/libraries/image_lib.html | |
parent | 114ab0988e20ac6be39ad363ff897a1a3b85e565 (diff) |
backed out 648b42a75739, which was a NON-trivial whitespace commit. It broke the Typography class's string replacements, for instance
Diffstat (limited to 'user_guide/libraries/image_lib.html')
-rw-r--r-- | user_guide/libraries/image_lib.html | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index e6d38fc96..dbf07768e 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -68,11 +68,11 @@ Image Manipulation Class <li>Image Watermarking</li> </ul> -<p>All three major image libraries are supported: GD/GD2, NetPBM, and ImageMagick</p> +<p>All three major image libraries are supported: GD/GD2, NetPBM, and ImageMagick</p> <p class="important"><strong>Note:</strong> Watermarking is only available using the GD/GD2 library. In addition, even though other libraries are supported, GD is required in -order for the script to calculate the image properties. The image processing, however, will be performed with the +order for the script to calculate the image properties. The image processing, however, will be performed with the library you specify.</p> @@ -82,14 +82,14 @@ library you specify.</p> using the <dfn>$this->load->library</dfn> function:</p> <code>$this->load->library('image_lib');</code> -<p>Once the library is loaded it will be ready for use. The image library object you will use to call all functions is: <dfn>$this->image_lib</dfn></p> +<p>Once the library is loaded it will be ready for use. The image library object you will use to call all functions is: <dfn>$this->image_lib</dfn></p> <h2>Processing an Image</h2> <p>Regardless of the type of processing you would like to perform (resizing, cropping, rotation, or watermarking), the general process is identical. You will set some preferences corresponding to the action you intend to perform, then -call one of four available processing functions. For example, to create an image thumbnail you'll do this:</p> +call one of four available processing functions. For example, to create an image thumbnail you'll do this:</p> <code>$config['image_library'] = 'gd2';<br /> $config['source_image'] = '/path/to/image/mypic.jpg';<br /> @@ -106,7 +106,7 @@ $this->image_lib->resize();</code> <p>The above code tells the <dfn>image_resize</dfn> function to look for an image called <em>mypic.jpg</em> located in the <dfn>source_image</dfn> folder, then create a thumbnail that is 75 X 50 pixels using the GD2 <dfn>image_library</dfn>. Since the <dfn>maintain_ratio</dfn> option is enabled, the thumb will be as close to the target <dfn>width</dfn> and -<dfn>height</dfn> as possible while preserving the original aspect ratio. The thumbnail will be called <em>mypic_thumb.jpg</em> +<dfn>height</dfn> as possible while preserving the original aspect ratio. The thumbnail will be called <em>mypic_thumb.jpg</em> </p> <p class="important"><strong>Note:</strong> In order for the image class to be allowed to do any processing, the @@ -126,7 +126,7 @@ folder containing the image files must have write permissions.</p> <li>$this->image_lib->clear()</li> </ul> -<p>These functions return boolean TRUE upon success and FALSE for failure. If they fail you can retrieve the +<p>These functions return boolean TRUE upon success and FALSE for failure. If they fail you can retrieve the error message using this function:</p> <code>echo $this->image_lib->display_errors();</code> @@ -138,7 +138,7 @@ error message using this function:</p> echo $this->image_lib->display_errors();<br /> }</code> -<p>Note: You can optionally specify the HTML formatting to be applied to the errors, by submitting the opening/closing +<p>Note: You can optionally specify the HTML formatting to be applied to the errors, by submitting the opening/closing tags in the function, like this:</p> <code>$this->image_lib->display_errors('<var><p></var>', '<var></p></var>');</code> @@ -146,11 +146,11 @@ tags in the function, like this:</p> <h2>Preferences</h2> -<p>The preferences described below allow you to tailor the image processing to suit your needs.</p> +<p>The preferences described below allow you to tailor the image processing to suit your needs.</p> <p>Note that not all preferences are available for every -function. For example, the x/y axis preferences are only available for image cropping. Likewise, the width and height -preferences have no effect on cropping. The "availability" column indicates which functions support a given preference.</p> +function. For example, the x/y axis preferences are only available for image cropping. Likewise, the width and height +preferences have no effect on cropping. The "availability" column indicates which functions support a given preference.</p> <p>Availability Legend:</p> @@ -187,7 +187,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>library_path</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">Sets the server path to your ImageMagick or NetPBM library. If you use either of those libraries you must supply the path.</td> +<td class="td">Sets the server path to your ImageMagick or NetPBM library. If you use either of those libraries you must supply the path.</td> <td class="td">R, C, X</td> </tr> @@ -195,7 +195,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>source_image</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">Sets the source image name/path. The path must be a relative or absolute server path, not a URL.</td> +<td class="td">Sets the source image name/path. The path must be a relative or absolute server path, not a URL.</td> <td class="td">R, C, S, W</td> </tr> @@ -203,7 +203,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>dynamic_output</strong></td> <td class="td">FALSE</td> <td class="td">TRUE/FALSE (boolean)</td> -<td class="td">Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.</td> +<td class="td">Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.</td> <td class="td">R, C, X, W</td> </tr> @@ -221,7 +221,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>new_image</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">Sets the destination image name/path. You'll use this preference when creating an image copy. The path must be a relative or absolute server path, not a URL.</td> +<td class="td">Sets the destination image name/path. You'll use this preference when creating an image copy. The path must be a relative or absolute server path, not a URL.</td> <td class="td">R, C, X, W</td> </tr> @@ -253,7 +253,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>thumb_marker</strong></td> <td class="td">_thumb</td> <td class="td">None</td> -<td class="td">Specifies the thumbnail indicator. It will be inserted just before the file extension, so mypic.jpg would become mypic_thumb.jpg</td> +<td class="td">Specifies the thumbnail indicator. It will be inserted just before the file extension, so mypic.jpg would become mypic_thumb.jpg</td> <td class="td">R</td> </tr> @@ -281,7 +281,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <td class="td"><strong>rotation_angle</strong></td> <td class="td">None</td> <td class="td">90, 180, 270, vrt, hor</td> -<td class="td">Specifies the angle of rotation when rotating images. Note that PHP rotates counter-clockwise, so a 90 degree rotation to the right must be specified as 270.</td> +<td class="td">Specifies the angle of rotation when rotating images. Note that PHP rotates counter-clockwise, so a 90 degree rotation to the right must be specified as 270.</td> <td class="td">X</td> </tr> @@ -306,7 +306,7 @@ preferences have no effect on cropping. The "availability" column indicates whic <h2>Setting preferences in a config file</h2> <p>If you prefer not to set preferences using the above method, you can instead put them into a config file. -Simply create a new file called <var>image_lib.php</var>, add the <var>$config</var> +Simply create a new file called <var>image_lib.php</var>, add the <var>$config</var> array in that file. Then save the file in: <var>config/image_lib.php</var> and it will be used automatically. You will NOT need to use the <dfn>$this->image_lib->initialize</dfn> function if you save your preferences in a config file.</p> @@ -319,7 +319,7 @@ or create a thumbnail image.</p> <p>For practical purposes there is no difference between creating a copy and creating a thumbnail except a thumb will have the thumbnail marker as part of the name (ie, mypic_thumb.jpg).</p> -<p>All preferences listed in the table above are available for this function except these three: rotation_angle, x_axis, and y_axis.</p> +<p>All preferences listed in the table above are available for this function except these three: rotation_angle, x_axis, and y_axis.</p> <h3>Creating a Thumbnail</h3> @@ -358,7 +358,7 @@ preferences for the X and Y axis (in pixels) specifying where to crop, like this <code>$config['x_axis'] = '100';<br /> $config['y_axis'] = '40';</code> -<p>All preferences listed in the table above are available for this function except these: rotation_angle, width, height, create_thumb, new_image.</p> +<p>All preferences listed in the table above are available for this function except these: rotation_angle, width, height, create_thumb, new_image.</p> <p>Here's an example showing how you might crop an image:</p> @@ -378,8 +378,8 @@ if ( ! $this->image_lib->crop())<br /> <p>Note: Without a visual interface it is difficult to crop images, so this function is not very useful -unless you intend to build such an interface. That's exactly what we did using for the photo -gallery module in ExpressionEngine, the CMS we develop. We added a JavaScript UI that lets the cropping +unless you intend to build such an interface. That's exactly what we did using for the photo +gallery module in ExpressionEngine, the CMS we develop. We added a JavaScript UI that lets the cropping area be selected.</p> <h2>$this->image_lib->rotate()</h2> @@ -443,7 +443,7 @@ containing your watermark over the source image.</li> <p>Just as with the other functions (resizing, cropping, and rotating) the general process for watermarking involves setting the preferences corresponding to the action you intend to perform, then -calling the watermark function. Here is an example:</p> +calling the watermark function. Here is an example:</p> <code> $config['source_image'] = '/path/to/image/mypic.jpg';<br /> @@ -452,9 +452,9 @@ $config['wm_type'] = 'text';<br /> $config['wm_font_path'] = './system/fonts/texb.ttf';<br /> $config['wm_font_size'] = '16';<br /> $config['wm_font_color'] = 'ffffff';<br /> -$config['wm_vrt_alignment'] = 'bottom';<br /> -$config['wm_hor_alignment'] = 'center';<br /> -$config['wm_padding'] = '20';<br /> +$config['wm_vrt_alignment'] = 'bottom';<br /> +$config['wm_hor_alignment'] = 'center';<br /> +$config['wm_padding'] = '20';<br /> <br /> $this->image_lib->initialize($config); <br /> @@ -462,7 +462,7 @@ $this->image_lib->initialize($config); $this->image_lib->watermark();</code> -<p>The above example will use a 16 pixel True Type font to create the text "Copyright 2006 - John Doe". The watermark +<p>The above example will use a 16 pixel True Type font to create the text "Copyright 2006 - John Doe". The watermark will be positioned at the bottom/center of the image, 20 pixels from the bottom of the image.</p> <p class="important"><strong>Note:</strong> In order for the image class to be allowed to do any processing, the image file must have "write" file permissions. For example, 777.</p> @@ -491,14 +491,14 @@ will be positioned at the bottom/center of the image, 20 pixels from the bottom <td class="td"><strong>source_image</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">Sets the source image name/path. The path must be a relative or absolute server path, not a URL.</td> +<td class="td">Sets the source image name/path. The path must be a relative or absolute server path, not a URL.</td> </tr> <tr> <td class="td"><strong>dynamic_output</strong></td> <td class="td">FALSE</td> <td class="td">TRUE/FALSE (boolean)</td> -<td class="td">Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.</td> +<td class="td">Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.</td> </tr> <tr> @@ -563,28 +563,28 @@ will be positioned at the bottom/center of the image, 20 pixels from the bottom <td class="td"><strong>wm_text</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">The text you would like shown as the watermark. Typically this will be a copyright notice.</td> +<td class="td">The text you would like shown as the watermark. Typically this will be a copyright notice.</td> </tr> <tr> <td class="td"><strong>wm_font_path</strong></td> <td class="td">None</td> <td class="td">None</td> -<td class="td">The server path to the True Type Font you would like to use. If you do not use this option, the native GD font will be used.</td> +<td class="td">The server path to the True Type Font you would like to use. If you do not use this option, the native GD font will be used.</td> </tr> <tr> <td class="td"><strong>wm_font_size</strong></td> <td class="td">16</td> <td class="td">None</td> -<td class="td">The size of the text. Note: If you are not using the True Type option above, the number is set using a range of 1 - 5. Otherwise, you can use any valid pixel size for the font you're using.</td> +<td class="td">The size of the text. Note: If you are not using the True Type option above, the number is set using a range of 1 - 5. Otherwise, you can use any valid pixel size for the font you're using.</td> </tr> <tr> <td class="td"><strong>wm_font_color</strong></td> <td class="td">ffffff</td> <td class="td">None</td> -<td class="td">The font color, specified in hex. Note, you must use the full 6 character hex value (ie, 993300), rather than the three character abbreviated version (ie fff).</td> +<td class="td">The font color, specified in hex. Note, you must use the full 6 character hex value (ie, 993300), rather than the three character abbreviated version (ie fff).</td> </tr> |