Skip to content

Commit a21aac8

Browse files
committed
docs: fix sample code
save() returns bool.
1 parent 716039a commit a21aac8

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
$image = \Config\Services::image()
4-
->withFile('/path/to/image/mypic.jpg')
3+
$image->withFile('/path/to/image/mypic.jpg')
54
->fit(100, 100, 'center')
65
->save('/path/to/image/mypic_thumb.jpg');

user_guide_src/source/libraries/images/004.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?php
22

3-
$image = \Config\Services::image()
4-
->withFile('/path/to/image/mypic.jpg')
3+
$image->withFile('/path/to/image/mypic.jpg')
54
->reorient()
65
->rotate(90)
76
->crop(100, 100, 0, 0)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
$image = \Config\Services::image()
4-
->withFile('/path/to/image/mypic.jpg')
3+
$image->withFile('/path/to/image/mypic.jpg')
54
// processing methods
65
->save('/path/to/image/my_low_quality_pic.jpg', 10);
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
$image = \Config\Services::image()
4-
->withFile('/path/to/image/mypic.jpg')
3+
$image->withFile('/path/to/image/mypic.jpg')
54
->withResource()
65
->save('/path/to/image/my_low_quality_pic.jpg', 10);
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?php
22

3+
$image = \Config\Services::image();
4+
35
try {
4-
$image = \Config\Services::image()
5-
->withFile('/path/to/image/mypic.jpg')
6+
$image->withFile('/path/to/image/mypic.jpg')
67
->fit(100, 100, 'center')
78
->save('/path/to/image/mypic_thumb.jpg');
8-
} catch (CodeIgniter\Images\ImageException $e) {
9+
} catch (CodeIgniter\Images\Exceptions\ImageException $e) {
910
echo $e->getMessage();
1011
}

0 commit comments

Comments
 (0)