public function operate(kOperator $operator = null, $inFilePath, $configFilePath = null)
 {
     if (kFile::fullMkfileDir($this->outFilePath)) {
         KalturaLog::debug('dir [' . $this->outFilePath . '] created');
         //outFilePath will be the path to the directory in which the images will be saved.
         $outDirPath = $this->outFilePath;
         //imageMagick decides the format of the output file according to the outFilePath's extension.so the format need to be added.
         $this->outFilePath = $this->outFilePath . DIRECTORY_SEPARATOR . basename($this->outFilePath) . self::LEADING_ZEROS_PADDING . '.' . $this->data->flavorParamsOutput->format;
     } else {
         KalturaLog::debug('failed to create [' . $this->outFilePath . '] directory');
         throw new KOperationEngineException('failed to create [' . $this->outFilePath . '] directory');
     }
     $ext = strtolower(pathinfo($inFilePath, PATHINFO_EXTENSION));
     $inputFormat = $this->getInputFormat();
     if ($inputFormat == self::PDF_FORMAT && $ext != 'pdf' && kFile::linkFile($inFilePath, "{$inFilePath}.pdf")) {
         $inFilePath = "{$inFilePath}.pdf";
     }
     if ($inputFormat == self::JPG_FORMAT && $ext != 'jpg' && kFile::linkFile($inFilePath, "{$inFilePath}.jpg")) {
         $inFilePath = "{$inFilePath}.jpg";
     }
     $realInFilePath = realpath($inFilePath);
     // Test input
     // - Test file type
     $errorMsg = $this->checkFileType($realInFilePath, $this->SUPPORTED_FILE_TYPES);
     if (!is_null($errorMsg)) {
         $this->data->engineMessage = $errorMsg;
     }
     // Test password required
     if ($this->testPasswordRequired($realInFilePath)) {
         $this->data->engineMessage = "Password required.";
     }
     parent::operate($operator, $realInFilePath, $configFilePath);
     $imagesList = kFile::dirList($outDirPath, false);
     // Test output
     // - Test black Image
     $identifyExe = KBatchBase::$taskConfig->params->identify;
     $firstImage = $outDirPath . DIRECTORY_SEPARATOR . $imagesList[0];
     $errorMsg = $this->testBlackImage($identifyExe, $firstImage, $errorMsg);
     if (!is_null($errorMsg)) {
         $this->data->engineMessage = $errorMsg;
     }
     $imagesListXML = $this->createImagesListXML($imagesList);
     kFile::setFileContent($outDirPath . DIRECTORY_SEPARATOR . self::IMAGES_LIST_XML_NAME, $imagesListXML->asXML());
     KalturaLog::info('images list xml [' . $outDirPath . DIRECTORY_SEPARATOR . self::IMAGES_LIST_XML_NAME . '] created');
     return true;
 }