ProductImageFileStorage
extends ImageFileStorage
in package
Class ProductImageFileStorage
Tags
Table of Contents
- $originalDir : WritableDirectory
- Original Dir (The original_images folder).
- $processing : ProductImageProcessingInterface
- Processing
- $productImageInUseService : ProductImageInUseServiceInterface
- $settings : EnvProductImageFileStorageSettings
- Settings
- $storageDirectory : WritableDirectory
- Storage Directory.
- __construct() : mixed
- deleteFile() : ProductImageFileStorage
- Delete File
- fileExists() : bool
- File Exists
- getFileList() : array<string|int, mixed>
- Returns a file list for a directory.
- importFile() : string
- Import File
- processImage() : ProductImageFileStorage
- Processes an image for the front end.
- productImageInUseService() : ProductImageInUseServiceInterface
- renameFile() : ProductImageFileStorage
- Rename File
- _createAndReturnNewFilename() : string
- Create and Return the New Filename
- _validateFile() : AbstractFileStorage
- Validates the provided file.
- _validateFilename() : AbstractFileStorage
- Validates the provided filename.
- addInfoMessageToStack() : mixed
Properties
$originalDir
Original Dir (The original_images folder).
protected
WritableDirectory
$originalDir
$processing
Processing
protected
ProductImageProcessingInterface
$processing
$productImageInUseService
protected
ProductImageInUseServiceInterface
$productImageInUseService
$settings
Settings
protected
EnvProductImageFileStorageSettings
$settings
$storageDirectory
Storage Directory.
protected
WritableDirectory
$storageDirectory
Methods
__construct()
public
__construct(ProductImagePathsSettingsInterface $settings, ProductImageProcessingInterface $processing) : mixed
Parameters
- $settings : ProductImagePathsSettingsInterface
- $processing : ProductImageProcessingInterface
Tags
Return values
mixed —deleteFile()
Delete File
public
deleteFile(FilenameStringType $filename) : ProductImageFileStorage
Deletes an existing file.
Parameters
- $filename : FilenameStringType
-
The file to delete.
Tags
Return values
ProductImageFileStorage —Same instance for chained method calls.
fileExists()
File Exists
public
fileExists(FilenameStringType $filename) : bool
Checks if the provided file exists.
Parameters
- $filename : FilenameStringType
-
The filename of the file to be checked.
Return values
bool —getFileList()
Returns a file list for a directory.
public
getFileList(WritableDirectory $directory[, array<string|int, mixed> $extensions = [] ]) : array<string|int, mixed>
Parameters
- $directory : WritableDirectory
-
Directory to scan.
- $extensions : array<string|int, mixed> = []
-
File extensions (optional).
Return values
array<string|int, mixed> —importFile()
Import File
public
importFile(ExistingFile $sourceFile, FilenameStringType $preferredFilename) : string
Saves an image to a writable directory.
Parameters
- $sourceFile : ExistingFile
-
The source file to import.
- $preferredFilename : FilenameStringType
-
The preferred name of the file to be saved.
Tags
Return values
string —Preferred filename
processImage()
Processes an image for the front end.
public
processImage(FilenameStringType $productImage) : ProductImageFileStorage
Parameters
- $productImage : FilenameStringType
Return values
ProductImageFileStorage —Same instance for chained method calls.
productImageInUseService()
public
productImageInUseService() : ProductImageInUseServiceInterface
Return values
ProductImageInUseServiceInterface —renameFile()
Rename File
public
renameFile(FilenameStringType $oldName, FilenameStringType $newName) : ProductImageFileStorage
Renames an existing image file.
Parameters
- $oldName : FilenameStringType
-
The old name of the file.
- $newName : FilenameStringType
-
The new name of the file.
Tags
Return values
ProductImageFileStorage —Same instance for chained method calls.
_createAndReturnNewFilename()
Create and Return the New Filename
protected
_createAndReturnNewFilename(FilenameStringType $existingFilename) : string
Checks whether the provided preferred filename already exists and generates one, with appending the next available number, which does not already exist.
Parameters
- $existingFilename : FilenameStringType
-
The existing filename to change.
Tags
Return values
string —The created filename
_validateFile()
Validates the provided file.
protected
abstract _validateFile(ExistingFile $sourceFile) : AbstractFileStorage
Parameters
- $sourceFile : ExistingFile
-
The file to validate.
Tags
Return values
AbstractFileStorage —Same instance for chained method calls.
_validateFilename()
Validates the provided filename.
protected
abstract _validateFilename(FilenameStringType $filename) : AbstractFileStorage
Parameters
- $filename : FilenameStringType
-
The filename to validate.
Tags
Return values
AbstractFileStorage —Same instance for chained method calls.
addInfoMessageToStack()
protected
addInfoMessageToStack(FilenameStringType $filename) : mixed
Parameters
- $filename : FilenameStringType