/**
  * Creates the different versions of images that are configured
  *
  * @param \Cake\ORM\Table $table
  * @param array $entity
  * @param array $operations
  * @throws \Burzum\FileStorage\Event\Exception
  * @throws \Exception
  * @return false|null
  */
 protected function _createVersions(Table $table, $entity, array $operations)
 {
     $Storage = StorageManager::adapter($entity['adapter']);
     $path = $this->_buildPath($entity, true);
     $tmpFile = $this->_tmpFile($Storage, $path, TMP . 'image-processing');
     foreach ($operations as $version => $imageOperations) {
         $hash = StorageUtils::hashOperations($imageOperations);
         $string = $this->_buildPath($entity, true, $hash);
         if ($this->adapterClass === 'AmazonS3' || $this->adapterClass === 'AwsS3') {
             $string = str_replace('\\', '/', $string);
         }
         if ($Storage->has($string)) {
             return false;
         }
         try {
             $image = $table->processImage($tmpFile, null, array('format' => $entity['extension']), $imageOperations);
             $Storage->write($string, $image->get($entity['extension']), true);
         } catch (\Exception $e) {
             $this->log($e->getMessage());
             unlink($tmpFile);
             throw $e;
         }
     }
     unlink($tmpFile);
 }