Image Manipulation - Convert |
Hello,
I'm trying to convert PNG to JPG using Image Manipulation Class PHP Code: \Config\Services::image() but it always show me error "Unable to save the image. Please make sure the image and file directory are writable". I've triple check permission folder but there's no problem with it. I also try with common way below with no problem PHP Code: $new_pic = imagecreatefrompng($file); I tried to trace to CI4 GDHandler.php and in save() I tried to var_dump($this->resource) but it return NULL. PHP Code: case IMAGETYPE_JPEG:
Hi, this aren't possible at this time with the current stable version. The resource are only available if you do some image manipulation.
It will work with withResource in the next version. https://github.com/codeigniter4/CodeIgniter4/pull/2963 You can however use procedure style at the moment. https://github.com/codeigniter4/CodeIgni...t.php#L372 (06-22-2020, 10:27 AM)jreklund Wrote: Hi, this aren't possible at this time with the current stable version. The resource are only available if you do some image manipulation. So you cannot just convert an image but need to do some other manipulation first? PHP Code: $image->withFile($file->getTempName()) something like that?
In the current state you can't just convert the image, you need to do at least one manipulation, or use procedure style coding. I don't have an release date for when you can do it.
|
Welcome Guest, Not a member yet? Register Sign In |