Welcome Guest, Not a member yet? Register   Sign In
Fix Codeigniter 4.1.9 Error
#3

(This post was last modified: 05-06-2022, 05:25 AM by kenjis.)

(04-29-2022, 09:55 PM)pvt Wrote: 2. Convert Imageg\Ser

User guide code:
Code:
\Config\Services::image()
    ->withFile('/path/to/image/mypic.jpg')
    ->convert(IMAGETYPE_PNG)
    ->save('/path/to/new/image.png');

Note: When I read sample code, I thought parameter for convert function is destination file but it wrong; parameter for convert() function must equal source file extension - with file save you can set new file (ex: *.png) 
You can get source file extension  with function pathinfo(). I hope this topic can help any body. Thanks for reading!
-
3.A

The documentation is no wrong. There is a bug.
See https://github.com/codeigniter4/CodeIgni...ssues/5966
The bug was fixed in the develop branch, and will be included in v4.2.0.

(04-29-2022, 09:55 PM)pvt Wrote:
Code:
\Config\Services::image('imagick')
    ->withFile('/path/to/image/mypic.jpg')
    ->text('Copyright 2017 My Photo Co', [
        'color'      => '#fff',
        'opacity'    => 0.5,
        'withShadow' => true,
        'hAlign'    => 'center',
        'vAlign'    => 'bottom',
        'fontSize'  => 20
    ])
    ->save('/path/to/new/image.jpg');

- Error message:
Code:
"Implicit conversion from float 88.89999999999999 to int loses precision" (error convert float to INT).

This bug was also fixed.
https://github.com/codeigniter4/CodeIgni...ssues/5941
Reply


Messages In This Thread
Fix Codeigniter 4.1.9 Error - by pvt - 04-29-2022, 09:55 PM
RE: Fix Codeigniter 4.1.9 Error - by kenjis - 04-30-2022, 01:10 AM
RE: Fix Codeigniter 4.1.9 Error - by kenjis - 05-06-2022, 05:22 AM
RE: Fix Codeigniter 4.1.9 Error - by ashaggy - 12-22-2022, 04:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB