Skip to content

Commit 67fa536

Browse files
authored
Merge pull request #8685 from kenjis/docs-images.rst
docs: minor improvements in images.rst
2 parents 3b86d09 + c729ffd commit 67fa536

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

user_guide_src/source/libraries/images.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ Regardless of the type of processing you would like to perform
4949
(resizing, cropping, rotation, or watermarking), the general process is
5050
identical. You will set some preferences corresponding to the action you
5151
intend to perform, then call one of the available processing functions.
52+
5253
For example, to create an image thumbnail you'll do this:
5354

5455
.. literalinclude:: images/003.php
5556

5657
The above code tells the library to look for an image
57-
called *mypic.jpg* located in the source_image folder, then create a
58-
new image from it that is 100 x 100pixels using the GD2 image_library,
59-
and save it to a new file (the thumb). Since it is using the ``fit()`` method,
58+
called **mypic.jpg** located in the **/path/to/image** folder, then create a
59+
new image from it that is 100 x 100 pixels,
60+
and save it to a new file **mypic_thumb.jpg**. Since it is using the ``fit()`` method,
6061
it will attempt to find the best portion of the image to crop based on the
6162
desired aspect ratio, and then crop and resize the result.
6263

@@ -68,7 +69,7 @@ previous results:
6869
.. literalinclude:: images/004.php
6970

7071
This example would take the same image and first fix any mobile phone orientation issues,
71-
rotate the image by 90 degrees, and then crop the result into a 100x100 pixel image,
72+
rotate the image by 90 degrees, and then crop the result into a 100 x 100 pixel image,
7273
starting at the top left corner. The result would be saved as the thumbnail.
7374

7475
.. note:: In order for the image class to be allowed to do any
@@ -85,7 +86,7 @@ Image Quality
8586

8687
``save()`` can take an additional parameter ``$quality`` to alter the resulting image
8788
quality. Values range from 0 to 100 with 90 being the framework default. This parameter
88-
only applies to JPEG and WEBP images, will be ignored otherwise:
89+
only applies to JPEG and WebP images, will be ignored otherwise:
8990

9091
.. note:: The parameter ``$quality`` for WebP can be used since v4.4.0.
9192

@@ -135,7 +136,7 @@ thumbnail images that should match a certain size/aspect ratio. This is handled
135136
- ``$maintainRatio`` will, if true, adjust the final dimensions as needed to maintain the image's original aspect ratio.
136137
- ``$masterDim`` specifies which dimension should be left untouched when ``$maintainRatio`` is true. Values can be: ``'width'``, ``'height'``, or ``'auto'``.
137138

138-
To take a 50x50 pixel square out of the center of an image, you would need to first calculate the appropriate x and y
139+
To take a 50 x 50 pixel square out of the center of an image, you would need to first calculate the appropriate x and y
139140
offset values:
140141

141142
.. literalinclude:: images/008.php
@@ -231,7 +232,7 @@ The ``rotate()`` method allows you to rotate an image in 90 degree increments::
231232
- ``$angle`` is the number of degrees to rotate. One of ``90``, ``180``, ``270``.
232233

233234
.. note:: While the ``$angle`` parameter accepts a float, it will convert it to an integer during the process.
234-
If the value is any other than the three values listed above, it will throw a CodeIgniter\Images\ImageException.
235+
If the value is any other than the three values listed above, it will throw a ``CodeIgniter\Images\ImageException``.
235236

236237
Adding a Text Watermark
237238
=======================
@@ -251,17 +252,17 @@ that allow you to specify how the text should be displayed:
251252

252253
The possible options that are recognized are as follows:
253254

254-
- ``color`` Text Color (hex number), i.e., #ff0000
255-
- ``opacity`` A number between 0 and 1 that represents the opacity of the text.
255+
- ``color`` Text Color (hex number), i.e., ``'#ff0000'``
256+
- ``opacity`` A number between ``0`` and ``1`` that represents the opacity of the text.
256257
- ``withShadow`` Boolean value whether to display a shadow or not.
257258
- ``shadowColor`` Color of the shadow (hex number)
258259
- ``shadowOffset`` How many pixels to offset the shadow. Applies to both the vertical and horizontal values.
259-
- ``hAlign`` Horizontal alignment: left, center, right
260-
- ``vAlign`` Vertical alignment: top, middle, bottom
260+
- ``hAlign`` Horizontal alignment: ``'left'``, ``'center'``, ``'right'``
261+
- ``vAlign`` Vertical alignment: ``'top'``, ``'middle'``, ``'bottom'``
261262
- ``hOffset`` Additional offset on the x axis, in pixels
262263
- ``vOffset`` Additional offset on the y axis, in pixels
263264
- ``fontPath`` The full server path to the TTF font you wish to use. System font will be used if none is given.
264-
- ``fontSize`` The font size to use. When using the GD handler with the system font, valid values are between 1-5.
265+
- ``fontSize`` The font size to use. When using the GD handler with the system font, valid values are between ``1`` to ``5``.
265266

266267
.. note:: The ImageMagick driver does not recognize full server path for fontPath. Instead, simply provide the
267268
name of one of the installed system fonts that you wish to use, i.e., Calibri.

0 commit comments

Comments
 (0)