public function onMediaEditorProcess($filePath) { jimport('joomla.filesystem.file'); $image = new JImage($filePath); if ($image->isLoaded() == false) { throw new LogicException('Failed to load image'); } $image->rotate(180, 0, false); $extension = JFile::getExt($filePath); if (in_array($extension, array('png', 'gif'))) { $imageType = $extension; } else { $imageType = 'jpg'; } $image->toFile($filePath, $imageType); }
/** * Test the JImage::rotate method without a loaded image. * * @return void * * @expectedException LogicException * @since 11.3 */ public function testRotateWithoutLoadedImage() { // Create a new JImage object without loading an image. $image = new JImage(); $image->rotate(90); }