lochmueller / focuspoint

🌅 Smartest TYPO3 Crop Tool ever 🌅
http://typo3.org/extensions/repository/view/focuspoint
22 stars 23 forks source link

TYPO3 12.4 - If an image has no crop information, this leads to an error #111

Open monosize opened 6 months ago

monosize commented 6 months ago

[ERROR] Processing task of image file- Exception: PHP Warning: rename(/var/www/html/public/typo3temp/assets/images/bb244917dcb7b55f445298ac5cec10bc.jpg,/var/www/html/public/processed/6/f/csm_8a3ed22a9de3329b6d12c51e7554e6b5d99d1766-fp-1-1-0-0_fd7f8f556f.jpg): No such file or directory in /var/www/html/vendor/typo3/cms-core/Classes/Resource/Driver/LocalDriver.php line 803

Missing fileadmin in path!

Target must be /var/www/html/public/fileadmin/_processed_/6/f/csm_8a3ed22a9de3329b6d12c51e7554e6b5d99d1766-fp-1-1-0-0_fd7f8f556f.jpg

Problem located in Classes/Xclass/LocalCropScaleMaskHelper.php

https://github.com/lochmueller/focuspoint/blob/d63aacba82ff32db3b84522fb81e87518e74e46a/Classes/Xclass/LocalCropScaleMaskHelper.php#L84-L89

Maybe wrong storage for $targetFIle?

lochmueller commented 6 months ago

Hey @monosize , could you run same debugging in your instance? The "ObjectAccess::setProperty" is very dirty. Perhaps we replace to few properties for the new file?! Could you check "$file->getStorage()". This should be storge "1" with LocalFilesystem driver pointing to fileadmin. You can also check "$file->getPublicUrl()" and check if the URL is right?! Regards, Tim

monosize commented 6 months ago

$file Storage -> Driver -> absoluteBasePath is set to TYPO3_PATH_WEB $targeFile Storage -> Dirver -> absoluteBasePath of is set to TYPO3_PATH_WEB + fileadmin

I think the storage of the $targetFile must not changed.

if there is no change to the storage of the $targetFile, then it works.

image image
lochmueller commented 6 months ago

Hey @monosize ,

thanks for the explaintation. But I think this is not the source of the problem. Because if you combine the "absolteBasePath" of the storage with the "identifier" of the file, both are right. Because typo3temp is directly in the public dir and the processed folder is in the fileadmin. And if we "change" the file, we also change the storgage, because the location is changed.

I try to reproduce the problem.... but I need some time and this could take some days/weeks.

Regards, Tim

monosize commented 6 months ago

Sorry, the screenshot is from before the change. Here is the data after the change in $targetFile

image

the combined path is then definitely not correct

/var/www/html/public/+ /_processed_/4/7/csm_b5121f4839f6b911854de978f286335c51b9a793-fp-4-3-0-0_1fd4e6feac.jpg

lochmueller commented 6 months ago

Hey @monosize ,

you are right. The line ObjectAccess::setProperty($targetFile, 'storage', $file->getStorage(), true); is strange I think. We do not reset the storage in the target file, because every file already has its storage and the storage could be different.

If you remove this line, everything works as expected?

Regards, Tim

monosize commented 6 months ago

The problem only occurred when using the f:image ViewHelper. When using the focuspoint:image ViewHelper there was no error, then $targetFile has the same storage as $file (typo3temp)

After removing the line it works with f:image

It also works with focuspoint:image Viewhelper