func Destroy(i *models.Image, destroyer Destroyer, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) error {
	// don't try to delete if the image is in a zip file
	if deleteFile && !file.IsZipPath(i.Path) {
		if err := fileDeleter.Files([]string{i.Path}); err != nil {
			return err
		}
	}

	if deleteGenerated {
		if err := fileDeleter.MarkGeneratedFiles(i); err != nil {
			return err
		}
	}

	return destroyer.Destroy(i.ID)
}
// Destroy destroys an image, optionally marking the file and generated files for deletion.
Destroy destroys an image, optionally marking the file and generated files for deletion.
// Destroy destroys an image optionally marking the file and generated files for deletion .
func Destroy(i *models.Image, destroyer Destroyer, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) error {
	if deleteFile && !file.IsZipPath(i.Path) {
		if err := fileDeleter.Files([]string{i.Path}); err != nil {
			return err
		}
	}
	if deleteGenerated {
		if err := fileDeleter.MarkGeneratedFiles(i); err != nil {
			return err
		}
	}
	return destroyer.Destroy(i.ID)
}
func Destroy ( i * models . Image , destroyer Destroyer , fileDeleter * FileDeleter , deleteGenerated , deleteFile bool ) error { if deleteFile && ! file . IsZipPath ( i . Path ) { if err := fileDeleter . Files ( [ ] string { i . Path } ) ; err != nil { return err } } if deleteGenerated { if err := fileDeleter . MarkGeneratedFiles ( i ) ; err != nil { return err } } return destroyer . Destroy ( i . ID ) }
Destroy destroys an image, optionally marking the file and generated files for deletion.
Destroy destroys an image optionally marking the file and generated files for deletion .
// don't try to delete if the image is in a zip file