/** * Only delete an additional image. * * @param integer $imageId Image ID * @param string $imagesFolder A path to the images folder. * @param integer $userId * * @throws RuntimeException */ public function removeExtraImage($imageId, $imagesFolder, $userId) { jimport("itprism.file.image"); jimport("itprism.file.remover.local"); jimport("crowdfunding.image.validator.owner"); jimport("crowdfunding.image.remover.extra"); $file = new ITPrismFileImage(); // Validate owner of the project. $ownerValidator = new CrowdFundingImageValidatorOwner(JFactory::getDbo(), $imageId, $userId); if (!$ownerValidator->isValid()) { throw new RuntimeException(JText::_("COM_CROWDFUNDING_INVALID_PROJECT")); } // Remove the image. $remover = new CrowdFundingImageRemoverExtra(JFactory::getDbo(), $imageId, $imagesFolder); $file->addRemover($remover); $file->remove(); }