Example #1
0
 /**
  * Deletes all related file to an attachment.
  *
  * @param Base\Model $resource   Currently processed resource.
  * @param string     $attachment Attachment file name.
  * @param string     $name       Name of the file.
  *
  * @access private
  * @static
  *
  * @return void
  */
 private static function deleteThumbnails(Base\Model $resource, $attachment, $name)
 {
     $_storage_path = $resource->attachmentsStoragePath($attachment);
     foreach (self::$attachments[$attachment]['thumbnails'] as $thumbnail) {
         try {
             if (file_exists($_storage_path . "{$thumbnail['size']}-{$name}")) {
                 Helpers\File::delete($_storage_path . "{$thumbnail['size']}-{$name}");
             }
         } catch (\Exception $e) {
             var_log($e->getMessage());
         }
     }
 }