Feature: #90068 - Implement better FileDumpController
See forge#90068
Description
FileDumpController can now process UIDs of sys_file_reference records and can adopt image sizes to records of sys_file.
Following URI-Parameters are now possible:
t(Type): Can be one off(sys_),file r(sys_) orfile_ reference p(sys_)file_ processedfile f(File): Use it for a UID of tablesys_file r(Reference): Use it for a UID of tablesys_file_ reference p(Processed): Use it for a UID of tablesys_file_ processedfile s(Size): Use it for a UID of tablesys_file_ processedfile cv(CropVariant): In case ofsys_, you can assign it a cropping variantfile_ reference
You have to choose one of these parameters:
f,
r or
p. It is not possible
to use them multiple times in one request.
The Parameter
s has following syntax: width:height:minW:minH:maxW:maxH. You
can leave this Parameter empty to load the file in original size. Parameter
width
and
height can feature the trailing
c or
m indicator like known from TS.
See the following example on how to create a URI using the
File for
a sys_file record with a fixed image size:
$queryParameterArray = ['eID' => 'dumpFile', 't' => 'f'];
$queryParameterArray['f'] = $resourceObject->getUid();
$queryParameterArray['s'] = '320c:280c';
$queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'resourceStorageDumpFile');
$publicUrl = GeneralUtility::locationHeaderUrl(PathUtility::getAbsoluteWebPath(Environment::getPublicPath() . '/index.php'));
$publicUrl .= '?' . http_build_query($queryParameterArray, '', '&', PHP_QUERY_RFC3986);
In this example crop variant
default and an image size of 320:280 will be
applied to a sys_file_reference record:
$queryParameterArray = ['eID' => 'dumpFile', 't' => 'r'];
$queryParameterArray['f'] = $resourceObject->getUid();
$queryParameterArray['s'] = '320c:280c:320:280:320:280';
$queryParameterArray['cv'] = 'default';
$queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'resourceStorageDumpFile');
$publicUrl = GeneralUtility::locationHeaderUrl(PathUtility::getAbsoluteWebPath(Environment::getPublicPath() . '/index.php'));
$publicUrl .= '?' . http_build_query($queryParameterArray, '', '&', PHP_QUERY_RFC3986);
This example shows the usage how to create a URI to load an image of sys_file_processedfile:
$queryParameterArray = ['eID' => 'dumpFile', 't' => 'p'];
$queryParameterArray['p'] = $resourceObject->getUid();
$queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'resourceStorageDumpFile');
$publicUrl = GeneralUtility::locationHeaderUrl(PathUtility::getAbsoluteWebPath(Environment::getPublicPath() . '/index.php'));
$publicUrl .= '?' . http_build_query($queryParameterArray, '', '&', PHP_QUERY_RFC3986);
There are some restriction while using the new URI-Parameters:
- You can't assign any size parameter to processed files, as they are already resized.
- You can't apply CropVariants to
sys_andfile sys_records.file_ processedfile
Impact
No impact, as this class was extended only. It's fully backwards compatible.