I'm using JImage to resize uploaded images but when I try to resize transparent png, the resulting image isn't copied to the directory. I'm not able to understand what the issue is. The toFile() method doesn't copy the transparent png in directory, it works well with jpg and png with no transparency.
The code that i'am using is the following :
$image = new JImage($originalFile);
$properties = JImage::getImageFileProperties($originalFile);
$resizedImage = $image->resize('200', '200', true);
$mime = $properties->mime;
if ($mime == 'image/jpeg')
{
$type = IMAGETYPE_JPEG;
}
elseif ($mime = 'image/png')
{
$type = IMAGETYPE_PNG;
}
elseif ($mime = 'image/gif')
{
$type = IMAGETYPE_GIF;
}
$resizedImage->toFile($finalFile, $type);
Any ideas on how to make it work with transparent png?