vhs
vhs copied to clipboard
v:media.image and cropping
Hi,
with TYPO3 11.5.19 and vhs 6.1.2 i determined that if you crop your image with the TYPO3 cropping editor, the image generated with v:media.image
is not cropped. Always the original image.
That is because in file /Classes/ViewHelpers/Media/Image/AbstractImageViewHelper.php at line 147 the class in the condition is wrong.
Original line:
if (is_object($src) && $src instanceof FileReference) {
You have to change the class to:
if (is_object($src) && $src instanceof \TYPO3\CMS\Core\Resource\FileReference) {
Because FileReference
is defined as TYPO3\CMS\Extbase\Domain\Model\FileReference;
in line 18.
And that is not true.
The second change is after that.
Original line:
$crop = (is_object($src) && $src instanceof FileReference) ? $src->_getProperty('crop') : null;
New line:
$crop = (is_object($src) && $src instanceof \TYPO3\CMS\Core\Resource\FileReference) ? $src->getProperty('crop') : null;
See also that _getProperty
(with underscrore) leads into following error:
Call to undefined method TYPO3\CMS\Core\Resource\FileReference::_getProperty()
Without underscore it works.
only if src is an object. with uid as src its working