Skip to content

Commit 2ee7e76

Browse files
committed
docs: decorate source code (variables, methods) with '``'
1 parent 33dcb92 commit 2ee7e76

1 file changed

Lines changed: 47 additions & 47 deletions

File tree

user_guide_src/source/libraries/images.rst

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Service function:
3333

3434
The available Handlers are as follows:
3535

36-
- gd The GD/GD2 image library
37-
- imagick The ImageMagick library.
36+
- ``gd`` The GD/GD2 image library
37+
- ``imagick`` The ImageMagick library.
3838

3939
If using the ImageMagick library, you must set the path to the library on your
4040
server in **app/Config/Images.php**.
@@ -58,7 +58,7 @@ For example, to create an image thumbnail you'll do this:
5858
The above code tells the library to look for an image
5959
called *mypic.jpg* located in the source_image folder, then create a
6060
new image from it that is 100 x 100pixels using the GD2 image_library,
61-
and save it to a new file (the thumb). Since it is using the fit() method,
61+
and save it to a new file (the thumb). Since it is using the ``fit()`` method,
6262
it will attempt to find the best portion of the image to crop based on the
6363
desired aspect ratio, and then crop and resize the result.
6464

@@ -103,14 +103,14 @@ Processing Methods
103103

104104
There are seven available processing methods:
105105

106-
- $image->crop()
107-
- $image->convert()
108-
- $image->fit()
109-
- $image->flatten()
110-
- $image->flip()
111-
- $image->resize()
112-
- $image->rotate()
113-
- $image->text()
106+
- ``$image->crop()``
107+
- ``$image->convert()``
108+
- ``$image->fit()``
109+
- ``$image->flatten()``
110+
- ``$image->flip()``
111+
- ``$image->resize()``
112+
- ``$image->rotate()``
113+
- ``$image->text()``
114114

115115
These methods return the class instance so they can be chained together, as shown above.
116116
If they fail they will throw a ``CodeIgniter\Images\ImageException`` that contains
@@ -127,12 +127,12 @@ thumbnail images that should match a certain size/aspect ratio. This is handled
127127

128128
crop(int $width = null, int $height = null, int $x = null, int $y = null, bool $maintainRatio = false, string $masterDim = 'auto')
129129

130-
- **$width** is the desired width of the resulting image, in pixels.
131-
- **$height** is the desired height of the resulting image, in pixels.
132-
- **$x** is the number of pixels from the left side of the image to start cropping.
133-
- **$y** is the number of pixels from the top of the image to start cropping.
134-
- **$maintainRatio** will, if true, adjust the final dimensions as needed to maintain the image's original aspect ratio.
135-
- **$masterDim** specifies which dimension should be left untouched when $maintainRatio is true. Values can be: 'width', 'height', or 'auto'.
130+
- ``$width`` is the desired width of the resulting image, in pixels.
131+
- ``$height`` is the desired height of the resulting image, in pixels.
132+
- ``$x`` is the number of pixels from the left side of the image to start cropping.
133+
- ``$y`` is the number of pixels from the top of the image to start cropping.
134+
- ``$maintainRatio`` will, if true, adjust the final dimensions as needed to maintain the image's original aspect ratio.
135+
- ``$masterDim`` specifies which dimension should be left untouched when ``$maintainRatio`` is true. Values can be: ``'width'``, ``'height'``, or ``'auto'``.
136136

137137
To take a 50x50 pixel square out of the center of an image, you would need to first calculate the appropriate x and y
138138
offset values:
@@ -146,12 +146,12 @@ The ``convert()`` method changes the library's internal indicator for the desire
146146

147147
convert(int $imageType)
148148

149-
- **$imageType** is one of PHP's image type constants (see for example https://www.php.net/manual/en/function.image-type-to-mime-type.php):
149+
- ``$imageType`` is one of PHP's image type constants (see for example https://www.php.net/manual/en/function.image-type-to-mime-type.php):
150150

151151
.. literalinclude:: images/009.php
152152

153153
.. note:: ImageMagick already saves files in the type
154-
indicated by their extension, ignoring **$imageType**
154+
indicated by their extension, ignoring ``$imageType``.
155155

156156
Fitting Images
157157
--------------
@@ -166,9 +166,9 @@ The ``fit()`` method aims to help simplify cropping a portion of an image in a "
166166

167167
fit(int $width, int $height = null, string $position = 'center')
168168

169-
- **$width** is the desired final width of the image.
170-
- **$height** is the desired final height of the image.
171-
- **$position** determines the portion of the image to crop out. Allowed positions: 'top-left', 'top', 'top-right', 'left', 'center', 'right', 'bottom-left', 'bottom', 'bottom-right'.
169+
- ``$width`` is the desired final width of the image.
170+
- ``$height`` is the desired final height of the image.
171+
- ``$position`` determines the portion of the image to crop out. Allowed positions: ``'top-left'``, ``'top'``, ``'top-right'``, ``'left'``, ``'center'``, ``'right'``, ``'bottom-left'``, ``'bottom'``, ``'bottom-right'``.
172172

173173
This provides a much simpler way to crop that will always maintain the aspect ratio:
174174

@@ -185,9 +185,9 @@ The ``flatten()`` method aims to add a background color behind transparent image
185185

186186
flatten(int $red = 255, int $green = 255, int $blue = 255)
187187

188-
- **$red** is the red value of the background.
189-
- **$green** is the green value of the background.
190-
- **$blue** is the blue value of the background.
188+
- ``$red`` is the red value of the background.
189+
- ``$green`` is the green value of the background.
190+
- ``$blue`` is the blue value of the background.
191191

192192
.. literalinclude:: images/011.php
193193

@@ -198,44 +198,44 @@ Images can be flipped along either their horizontal or vertical axis::
198198

199199
flip(string $dir)
200200

201-
- **$dir** specifies the axis to flip along. Can be either 'vertical' or 'horizontal'.
201+
- ``$dir`` specifies the axis to flip along. Can be either ``'vertical'`` or ``'horizontal'``.
202202

203203
.. literalinclude:: images/012.php
204204

205205
Resizing Images
206206
---------------
207207

208-
Images can be resized to fit any dimension you require with the resize() method::
208+
Images can be resized to fit any dimension you require with the ``resize()`` method::
209209

210210
resize(int $width, int $height, bool $maintainRatio = false, string $masterDim = 'auto')
211211

212-
- **$width** is the desired width of the new image in pixels
213-
- **$height** is the desired height of the new image in pixels
214-
- **$maintainRatio** determines whether the image is stretched to fit the new dimensions, or the original aspect ratio is maintained.
215-
- **$masterDim** specifies which axis should have its dimension honored when maintaining ratio. Either 'width', 'height'.
212+
- ``$width`` is the desired width of the new image in pixels
213+
- ``$height`` is the desired height of the new image in pixels
214+
- ``$maintainRatio`` determines whether the image is stretched to fit the new dimensions, or the original aspect ratio is maintained.
215+
- ``$masterDim`` specifies which axis should have its dimension honored when maintaining ratio. Either ``'width'``, ``'height'``.
216216

217217
When resizing images you can choose whether to maintain the ratio of the original image, or stretch/squash the new
218-
image to fit the desired dimensions. If $maintainRatio is true, the dimension specified by $masterDim will stay the same,
218+
image to fit the desired dimensions. If ``$maintainRatio`` is true, the dimension specified by ``$masterDim`` will stay the same,
219219
while the other dimension will be altered to match the original image's aspect ratio.
220220

221221
.. literalinclude:: images/013.php
222222

223223
Rotating Images
224224
---------------
225225

226-
The rotate() method allows you to rotate an image in 90 degree increments::
226+
The ``rotate()`` method allows you to rotate an image in 90 degree increments::
227227

228228
rotate(float $angle)
229229

230-
- **$angle** is the number of degrees to rotate. One of '90', '180', '270'.
230+
- ``$angle`` is the number of degrees to rotate. One of ``90``, ``180``, ``270``.
231231

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

235235
Adding a Text Watermark
236236
-----------------------
237237

238-
You can overlay a text watermark onto the image very simply with the text() method. This is useful for placing copyright
238+
You can overlay a text watermark onto the image very simply with the ``text()`` method. This is useful for placing copyright
239239
notices, photographer names, or simply marking the images as a preview so they won't be used in other people's final
240240
products.
241241

@@ -250,17 +250,17 @@ that allow you to specify how the text should be displayed:
250250

251251
The possible options that are recognized are as follows:
252252

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

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

0 commit comments

Comments
 (0)