You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/libraries/images.rst
+13-12Lines changed: 13 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -49,14 +49,15 @@ Regardless of the type of processing you would like to perform
49
49
(resizing, cropping, rotation, or watermarking), the general process is
50
50
identical. You will set some preferences corresponding to the action you
51
51
intend to perform, then call one of the available processing functions.
52
+
52
53
For example, to create an image thumbnail you'll do this:
53
54
54
55
.. literalinclude:: images/003.php
55
56
56
57
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,
60
61
it will attempt to find the best portion of the image to crop based on the
61
62
desired aspect ratio, and then crop and resize the result.
62
63
@@ -68,7 +69,7 @@ previous results:
68
69
.. literalinclude:: images/004.php
69
70
70
71
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,
72
73
starting at the top left corner. The result would be saved as the thumbnail.
73
74
74
75
.. note:: In order for the image class to be allowed to do any
@@ -85,7 +86,7 @@ Image Quality
85
86
86
87
``save()`` can take an additional parameter ``$quality`` to alter the resulting image
87
88
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:
89
90
90
91
.. note:: The parameter ``$quality`` for WebP can be used since v4.4.0.
91
92
@@ -135,7 +136,7 @@ thumbnail images that should match a certain size/aspect ratio. This is handled
135
136
- ``$maintainRatio`` will, if true, adjust the final dimensions as needed to maintain the image's original aspect ratio.
136
137
- ``$masterDim`` specifies which dimension should be left untouched when ``$maintainRatio`` is true. Values can be: ``'width'``, ``'height'``, or ``'auto'``.
137
138
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
139
140
offset values:
140
141
141
142
.. literalinclude:: images/008.php
@@ -231,7 +232,7 @@ The ``rotate()`` method allows you to rotate an image in 90 degree increments::
231
232
- ``$angle`` is the number of degrees to rotate. One of ``90``, ``180``, ``270``.
232
233
233
234
.. 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``.
235
236
236
237
Adding a Text Watermark
237
238
=======================
@@ -251,17 +252,17 @@ that allow you to specify how the text should be displayed:
251
252
252
253
The possible options that are recognized are as follows:
253
254
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.
256
257
- ``withShadow`` Boolean value whether to display a shadow or not.
257
258
- ``shadowColor`` Color of the shadow (hex number)
258
259
- ``shadowOffset`` How many pixels to offset the shadow. Applies to both the vertical and horizontal values.
259
-
- ``hAlign`` Horizontal alignment: left, center, right
0 commit comments