Skip to content

Commit 8b7dfcb

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents aea4197 + 533717c commit 8b7dfcb

File tree

6 files changed

+87
-21
lines changed

6 files changed

+87
-21
lines changed

.gitattributes

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,33 @@
55

66
# git files
77
.gitattributes export-ignore
8-
.gitignore export-ignore
8+
.gitignore export-ignore
99

10-
# Don't give admin files
11-
.github/ export-ignore
12-
admin/ export-ignore
13-
contributing/ export-ignore
14-
.editorconfig export-ignore
15-
.nojekyll export-ignore
10+
# admin files
11+
.github/ export-ignore
12+
admin/ export-ignore
13+
contributing/ export-ignore
14+
.editorconfig export-ignore
1615
CODE_OF_CONDUCT.md export-ignore
17-
CONTRIBUTING.md export-ignore
16+
CONTRIBUTING.md export-ignore
1817

19-
# They don't want our test files
20-
tests/AutoReview/ export-ignore
21-
tests/system/ export-ignore
22-
utils/ export-ignore
23-
deptrac.yaml export-ignore
24-
rector.php export-ignore
25-
phpunit.xml.dist export-ignore
26-
phpstan-baseline.neon.dist export-ignore
27-
phpstan.neon.dist export-ignore
28-
phpstan-bootstrap.php export-ignore
29-
.php-cs-fixer.dist.php export-ignore
30-
.php-cs-fixer.no-header.php export-ignore
18+
# contributor/development files
19+
tests/ export-ignore
20+
utils/ export-ignore
21+
.php-cs-fixer.dist.php export-ignore
22+
.php-cs-fixer.no-header.php export-ignore
3123
.php-cs-fixer.user-guide.php export-ignore
24+
deptrac.yaml export-ignore
25+
phpstan-baseline.neon.dist export-ignore
26+
phpstan-bootstrap.php export-ignore
27+
phpstan.neon.dist export-ignore
28+
phpunit.xml.dist export-ignore
29+
psalm_autoload.php export-ignore
30+
psalm-baseline.php export-ignore
31+
psalm.xml export-ignore
32+
rector.php export-ignore
3233

33-
# The source user guide, either
34+
# source user guide
3435
user_guide_src/ export-ignore
36+
.nojekyll export-ignore
3537
phpdoc.dist.xml export-ignore

user_guide_src/source/installation/upgrade_447.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ All Changes
118118
This is a list of all files in the **project space** that received changes;
119119
many will be simple comments or formatting that have no effect on the runtime:
120120

121+
- app/Config/App.php
121122
- app/Config/Cache.php
122123
- app/Config/ContentSecurityPolicy.php
123124
- app/Config/Database.php

user_guide_src/source/installation/upgrade_4xx.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Upgrading Libraries
251251
upgrade_encryption
252252
upgrade_file_upload
253253
upgrade_html_tables
254+
upgrade_images
254255
upgrade_localization
255256
upgrade_migrations
256257
upgrade_pagination
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Upgrade Image Manipulation Class
2+
################################
3+
4+
.. contents::
5+
:local:
6+
:depth: 2
7+
8+
Documentations
9+
==============
10+
11+
- `Image Manipulation Class Documentation CodeIgniter 3.X <https://www.codeigniter.com/userguide3/libraries/image_lib.html>`_
12+
- :doc:`Image Manipulation Class Documentation CodeIgniter 4.X <../libraries/images>`
13+
14+
What has been changed
15+
=====================
16+
- The preferences passed to the constructor or ``initialize()`` method in CI3
17+
have been changed to be specified in the new methods in CI4.
18+
- Some preferences like ``create_thumb`` are removed.
19+
- In CI4, the ``save()`` method must be called to save the manipulated image.
20+
- The ``display_errors()`` has been removed, and an exception will be thrown
21+
if an error occurs.
22+
23+
Upgrade Guide
24+
=============
25+
1. Within your class change the ``$this->load->library('image_lib');`` to
26+
``$image = \Config\Services::image();``.
27+
2. Change the preferences passed to the constructor or ``initialize()`` method
28+
to be specified in the corresponding methods.
29+
3. Call the ``save()`` method to save the file.
30+
31+
Code Example
32+
============
33+
34+
CodeIgniter Version 3.x
35+
------------------------
36+
37+
.. literalinclude:: upgrade_images/ci3sample/001.php
38+
39+
CodeIgniter Version 4.x
40+
-----------------------
41+
42+
.. literalinclude:: upgrade_images/001.php
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$image = \Config\Services::image();
4+
5+
$image
6+
->withFile('/path/to/image/mypic.jpg')
7+
->resize(75, 50, true)
8+
->save('/path/to/image/mypic_thumb.jpg');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
$config['image_library'] = 'gd2';
4+
$config['source_image'] = '/path/to/image/mypic.jpg';
5+
$config['create_thumb'] = TRUE;
6+
$config['maintain_ratio'] = TRUE;
7+
$config['width'] = 75;
8+
$config['height'] = 50;
9+
10+
$this->load->library('image_lib', $config);
11+
12+
$this->image_lib->resize();

0 commit comments

Comments
 (0)