TYPO3
7.6
|
Public Attributes | |
const | CONTEXT_IMAGEPREVIEW = 'Image.Preview' |
const | CONTEXT_IMAGECROPSCALEMASK = 'Image.CropScaleMask' |
Public Attributes inherited from AbstractFile | |
const | FILETYPE_UNKNOWN = 0 |
const | FILETYPE_TEXT = 1 |
const | FILETYPE_IMAGE = 2 |
const | FILETYPE_AUDIO = 3 |
const | FILETYPE_VIDEO = 4 |
const | FILETYPE_APPLICATION = 5 |
Protected Member Functions | |
reconstituteFromDatabaseRecord (array $databaseRow) | |
isUnchanged () | |
Protected Attributes | |
$taskType | |
$task | |
$taskTypeRegistry | |
$processingConfiguration | |
$originalFile | |
$originalFileSha1 | |
$updated = false | |
Protected Attributes inherited from AbstractFile | |
$properties | |
$storage = null | |
$identifier | |
$name | |
$deleted = false | |
Representation of a specific processed version of a file. These are created by the FileProcessingService, which in turn uses helper classes for doing the actual file processing. See there for a detailed description.
Objects of this class may be freshly created during runtime or being fetched from the database. The latter indicates that the file has been processed earlier and was then cached.
Each processed file—besides belonging to one file—has been created for a certain task (context) and configuration. All these won't change during the lifetime of a processed file; the only thing that can change is the original file, or rather it's contents. In that case, the processed file has to be processed again. Detecting this is done via comparing the current SHA1 hash of the original file against the one it had at the time the file was processed. The configuration of a processed file indicates what should be done to the original file to create the processed version. This may include things like cropping, scaling, rotating, flipping or using some special magic. A file may also meet the expectations set in the configuration without any processing. In that case, the ProcessedFile object still exists, but there is no physical file directly linked to it. Instead, it then redirects most method calls to the original file object. The data of these objects are also stored in the database, to indicate that no processing is required. With such files, the identifier and name fields in the database are empty to show this.
Definition at line 38 of file ProcessedFile.php.
__construct | ( | File | $originalFile, |
$taskType, | |||
array | $processingConfiguration, | ||
array | $databaseRow = null |
||
) |
Constructor for a processed file object. Should normally not be used directly, use the corresponding factory methods instead.
File | $originalFile | |
string | $taskType | |
array | $processingConfiguration | |
array | $databaseRow |
Definition at line 112 of file ProcessedFile.php.
References ProcessedFile\$originalFile, ProcessedFile\$processingConfiguration, ProcessedFile\$taskType, AbstractFile\getStorage(), and ProcessedFile\reconstituteFromDatabaseRecord().
calculateChecksum | ( | ) |
Returns a unique checksum for this file's processing configuration and original file.
Definition at line 152 of file ProcessedFile.php.
References ProcessedFile\getTask().
Referenced by ProcessedFile\generateProcessedFileNameWithoutExtension(), ImageService\getCompatibilityImageResourceValues(), ProcessedFile\needsReprocessing(), and ProcessedFile\toArray().
delete | ( | $force = false | ) |
Delete processed file
bool | $force |
Definition at line 420 of file ProcessedFile.php.
References ProcessedFile\isUnchanged(), and ProcessedFile\usesOriginalFile().
generateProcessedFileNameWithoutExtension | ( | ) |
Generate the name of of the new File
Definition at line 541 of file ProcessedFile.php.
References AbstractFile\$name, and ProcessedFile\calculateChecksum().
getIdentifier | ( | ) |
Get the identifier of the file
If there is no processed file in the file system (as the original file did not have to be modified e.g. when the original image is in the boundaries of the maxW/maxH stuff), then just return the identifier of the original file
Implements ResourceInterface.
Definition at line 292 of file ProcessedFile.php.
References ProcessedFile\getOriginalFile(), and ProcessedFile\usesOriginalFile().
Referenced by ProcessedFile\toArray().
getName | ( | ) |
Get the name of the file
If there is no processed file in the file system (as the original file did not have to be modified e.g. when the original image is in the boundaries of the maxW/maxH stuff) then just return the name of the original file
Implements ResourceInterface.
Definition at line 306 of file ProcessedFile.php.
References AbstractFile\$name, and ProcessedFile\usesOriginalFile().
Referenced by ProcessedFile\toArray(), and ResourceStorage\updateProcessedFile().
getOriginalFile | ( | ) |
Getter for the Original, unprocessed File
Definition at line 278 of file ProcessedFile.php.
References ProcessedFile\$originalFile.
Referenced by ImageService\getCompatibilityImageResourceValues(), ProcessedFile\getIdentifier(), ProcessedFile\getPublicUrl(), and PreviewProcessing\getTargetFileName().
getProcessingConfiguration | ( | ) |
Returns the processing information
Definition at line 506 of file ProcessedFile.php.
References ProcessedFile\$processingConfiguration.
getProperty | ( | $key | ) |
Getter for file-properties
string | $key |
Implements FileInterface.
Definition at line 440 of file ProcessedFile.php.
References ProcessedFile\isUnchanged().
Referenced by ImageService\getCompatibilityImageResourceValues().
getPublicUrl | ( | $relativeToCurrentScript = false | ) |
Returns a publicly accessible URL for this file
bool | $relativeToCurrentScript | Determines whether the URL returned should be relative to the current script, in case it is relative at all |
Implements FileInterface.
Definition at line 556 of file ProcessedFile.php.
References elseif, ProcessedFile\getOriginalFile(), AbstractFile\getStorage(), and ProcessedFile\usesOriginalFile().
Referenced by ImageService\getCompatibilityImageResourceValues().
getTask | ( | ) |
Returns the task object associated with this processed file.
\RuntimeException |
Definition at line 527 of file ProcessedFile.php.
References ProcessedFile\$task.
Referenced by ProcessedFile\calculateChecksum(), and PreviewProcessing\getTargetFileName().
getTaskIdentifier | ( | ) |
Getter for the task identifier.
Definition at line 516 of file ProcessedFile.php.
References ProcessedFile\$taskType.
getUid | ( | ) |
Returns the uid of this file
Definition at line 455 of file ProcessedFile.php.
Referenced by ProcessedFile\toArray().
isIndexed | ( | ) |
Returns TRUE if this file is indexed
Implements FileInterface.
Definition at line 203 of file ProcessedFile.php.
isNew | ( | ) |
Checks whether the ProcessedFile Object is newly created
Definition at line 224 of file ProcessedFile.php.
References ProcessedFile\isPersisted().
isOutdated | ( | ) |
Returns TRUE if the original file of this file changed and the file should be processed again.
Definition at line 409 of file ProcessedFile.php.
References ProcessedFile\needsReprocessing().
isPersisted | ( | ) |
Checks whether the ProcessedFile already has an entry in sys_file_processedfile table
Definition at line 214 of file ProcessedFile.php.
Referenced by ProcessedFile\isNew(), and ProcessedFile\isProcessed().
isProcessed | ( | ) |
Returns TRUE if this file is already processed.
Definition at line 268 of file ProcessedFile.php.
References ProcessedFile\isPersisted(), and ProcessedFile\needsReprocessing().
|
protected |
Returns TRUE if this file has not been changed during processing (i.e., we just deliver the original file)
Definition at line 380 of file ProcessedFile.php.
References ProcessedFile\usesOriginalFile().
Referenced by ProcessedFile\delete(), ProcessedFile\getProperty(), and ProcessedFile\updateProperties().
isUpdated | ( | ) |
Checks whether the object since last reconstitution, and therefore needs persistence again
Definition at line 235 of file ProcessedFile.php.
References ProcessedFile\$updated.
needsReprocessing | ( | ) |
Checks if the ProcessedFile needs reprocessing
Definition at line 466 of file ProcessedFile.php.
References ProcessedFile\$originalFileSha1, ProcessedFile\calculateChecksum(), AbstractFile\exists(), and ProcessedFile\usesOriginalFile().
Referenced by ProcessedFile\isOutdated(), and ProcessedFile\isProcessed().
|
protected |
Creates a ProcessedFile object from a database record.
array | $databaseRow |
Definition at line 131 of file ProcessedFile.php.
Referenced by ProcessedFile\__construct().
setContents | ( | $contents | ) |
Replace the current file contents with the given string
string | $contents | The contents to write to the file. |
\BadMethodCallException |
Implements FileInterface.
Definition at line 167 of file ProcessedFile.php.
setName | ( | $name | ) |
Sets a new file name
string | $name |
Definition at line 245 of file ProcessedFile.php.
References AbstractFile\$name, and AbstractFile\exists().
setUsesOriginalFile | ( | ) |
Definition at line 388 of file ProcessedFile.php.
toArray | ( | ) |
Basic array function for the DB update
Implements FileInterface.
Definition at line 345 of file ProcessedFile.php.
References ProcessedFile\$originalFileSha1, AbstractFile\$properties, ProcessedFile\calculateChecksum(), ProcessedFile\getIdentifier(), ProcessedFile\getName(), AbstractFile\getStorage(), ProcessedFile\getUid(), and ProcessedFile\usesOriginalFile().
updateProperties | ( | array | $properties | ) |
Updates properties of this object. Do not use this to reconstitute an object from the database; use reconstituteFromDatabaseRecord() instead!
array | $properties |
Definition at line 321 of file ProcessedFile.php.
References MathUtility\canBeInterpretedAsInteger(), AbstractFile\exists(), and ProcessedFile\isUnchanged().
Referenced by ProcessedFile\updateWithLocalFile().
updateWithLocalFile | ( | $filePath | ) |
Injects a local file, which is a processing result into the object.
string | $filePath |
\RuntimeException |
Definition at line 179 of file ProcessedFile.php.
References ProcessedFile\updateProperties().
usesOriginalFile | ( | ) |
Definition at line 399 of file ProcessedFile.php.
Referenced by ProcessedFile\delete(), ProcessedFile\getIdentifier(), ProcessedFile\getName(), ProcessedFile\getPublicUrl(), ProcessedFile\isUnchanged(), ProcessedFile\needsReprocessing(), and ProcessedFile\toArray().
|
protected |
Definition at line 84 of file ProcessedFile.php.
Referenced by ProcessedFile\__construct(), and ProcessedFile\getOriginalFile().
|
protected |
Definition at line 93 of file ProcessedFile.php.
Referenced by ProcessedFile\needsReprocessing(), and ProcessedFile\toArray().
|
protected |
Definition at line 77 of file ProcessedFile.php.
Referenced by ProcessedFile\__construct(), and ProcessedFile\getProcessingConfiguration().
|
protected |
Definition at line 65 of file ProcessedFile.php.
Referenced by ProcessedFile\getTask().
|
protected |
Definition at line 60 of file ProcessedFile.php.
Referenced by ProcessedFile\__construct(), and ProcessedFile\getTaskIdentifier().
|
protected |
Definition at line 70 of file ProcessedFile.php.
|
protected |
Definition at line 101 of file ProcessedFile.php.
Referenced by ProcessedFile\isUpdated().
const CONTEXT_IMAGECROPSCALEMASK = 'Image.CropScaleMask' |
Standard processing context for the frontend, that was previously in ::getImgResource which only takes cropping, masking and scaling into account
Definition at line 53 of file ProcessedFile.php.
Referenced by ImageService\applyProcessingInstructions(), MagicImageService\createMagicImage(), DefaultAvatarProvider\getImage(), ImageManipulationElement\getPreview(), and InlineRecordContainer\renderForeignRecordHeader().
const CONTEXT_IMAGEPREVIEW = 'Image.Preview' |
Basic processing context to get a processed image with smaller width/height to render a preview
Definition at line 47 of file ProcessedFile.php.
Referenced by FileInfoHook\renderFileInformationContent(), and FileBrowser\renderFilesInFolder().