-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Force creation of Image #2144
Force creation of Image #2144
Conversation
Contao 4.8 introduced a Deferred image resizing concept to boost performance. This may cause issue like no product image in Isotope Invoice PDF.
if (!is_file(TL_ROOT . '/' . $picture['img']['src'])) { | ||
$src = \System::getContainer()->get('contao.image.image_factory')->create(TL_ROOT . '/' . $picture['img']['src']); | ||
\System::getContainer()->get('contao.image.resizer')->resizeDeferredImage($src); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about images in a srcset
or multiple <source>
s? I mean, not that it really matters for PDF creation, but technically all the sources would neet to be resized in advance.
/cc @ausi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
srcset
is used only in browsers. There we don't have any problems. The problem is only in PDF generation.
If I understand correctly, this would always create all images for all galleries of all products? So deferred images would essentially be lost for Isotope? |
True, it should only be done for the generation of images when creating a document. |
Yes.
Ideally yes. There is at the moment no way of knowing from where the image is called. As it is always called inside a template, which can be used by both PDF and website. I think a possible solution might be to change method |
You could check for |
Is it so? Also for checkout process, where I generate PDF to send with order email? |
Hm, you are right, that won't work. The dirty way would be to define a scope via |
I think we should fix that when creating the PDF document in https://github.com/isotope/core/blob/master/system/modules/isotope/library/Isotope/Model/Document/Standard.php#L220 if (method_exists(File::class, 'createIfDeferred')) {
(new File(rawurldecode($args[2])))->createIfDeferred();
} |
Yes, it works with @ausi's fix. Thank you |
Contao 4.8 introduced a Deferred image resizing concept to boost performance. This may cause issue like no product image in Isotope Invoice PDF.