Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v:media.image and cropping #1817

Open
timofo opened this issue Dec 6, 2022 · 1 comment
Open

v:media.image and cropping #1817

timofo opened this issue Dec 6, 2022 · 1 comment

Comments

@timofo
Copy link

timofo commented Dec 6, 2022

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.

@timofo
Copy link
Author

timofo commented Dec 15, 2022

only if src is an object.
with uid as src its working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant