I recognized some strange behavior using JImage with transparent images. I want to show you two examples:
The code for this examples is:
Code: Select all
jimport('joomla.image.image');
$image1 = new JImage(JPATH_COMPONENT.DS.'test'.DS.'unprocessed.png');
$image2 = new JImage(JPATH_COMPONENT.DS.'test'.DS.'preprocessed.png');
$properties1 = Jimage::getImageFileProperties(JPATH_COMPONENT.DS.'test'.DS.'unprocessed.png');
$properties2 = Jimage::getImageFileProperties(JPATH_COMPONENT.DS.'test'.DS.'preprocessed.png');
$image1->toFile(JPATH_COMPONENT.DS.'test'.DS.'unprocessed_after.png', $properties1->type);
$image2->toFile(JPATH_COMPONENT.DS.'test'.DS.'preprocessed_after.png', $properties2->type);
Since I can only upload a maxium of three images, the next example will be in the next post.