Welcome Guest, Not a member yet? Register   Sign In
Compress image with ci 4 library removes png transparency and Incorrect APP1 Exif
#1

(This post was last modified: 01-27-2021, 05:29 AM by Kohryu. Edit Reason: added more issue )

I am using compress image from codeigniter 4 library with below code :
Code:
\Config\Services::image()->withFile($this->request->getFile('storeimage'))->reorient()->save('images/store/test.png', 70)


But it removes transparency png image. Can i compress png image without losses the transparency in ci 4?

and also for some image i hit error below :
("exif_read_data(php3CBA.tmp):Incorrect APP1 Exif Identifier Code")
Reply
#2

If you are using v4.0.4 or below, there has already been a fix for this exif error in the develop branch. The next release will fix this.
Reply
#3

(This post was last modified: 01-28-2021, 09:41 PM by Kohryu.)

(01-28-2021, 11:04 AM)paulbalandan Wrote: If you are using v4.0.4 or below, there has already been a fix for this exif error in the develop branch. The next release will fix this.

Noted with thanks.

How about the compress image?

I put below code in GDHanlder.php (save function) but it makes compress image not working, image size result still same and not compressed

Code:
imageAlphaBlending($this->resource, true);
imageSaveAlpha($this->resource, true);

Code:
case IMAGETYPE_PNG:
    imageAlphaBlending($this->resource, true);
    imageSaveAlpha($this->resource, true);

    if (! function_exists('imagepng'))
    {
        throw ImageException::forInvalidImageCreate(lang('images.pngNotSupported'));
    }

    if (! @imagepng($this->resource, $target))
    {
        throw ImageException::forSaveFailed();
    }
    break;
Reply




Theme © iAndrew 2016 - Forum software by © MyBB