#59067Always render image in temp directory
Description
When rendering an image, TYPO3 6.x places it in the processed temp folder, where all temporary files are stored.
UNLESS the desired rendering size is equal to the file’s original size. Then it will link to the original source file instead. This sounds economical and performance-conscious, but in some cases, this is not desirable.
I first posted this on Stackoverflow , where I learned that it’s probably the ImageViewHelper who’s designed to “Resize a given image (if required) and render the respective img tag”.
My suggestion would be that, also for the sake of consistency, ImageViewHelper (if it’s really the one who does it) would always place the used image in the processed folder. Even when it’s not been rendered.
A use case:
I have all source images in a protected directory where access is handled by naw_securedownloads. So the img tag becomes something like this:
<img src="http://www.example.com/index.php?eID=tx_nawsecuredl&u=0&g=0&t=1399912827&hash=0a111ac62d806a0ff26649b065f03be674e7d9b3&file=fileadmin/private/images/example.png" />
Which then necomes performance issue, as the image won’t be compressed nor cached properly, it seems.
So the performance-friendly idea of only creating a copy of the image when necessary works the other way.
Another use case:
Maybe simply don’t want the original directories where the images are stored to appear in the frontend. E.g. if editors make deep nested directory structures or use some wording not ideal for public (e.g. something like /photos/photos/myphotos/uglytemporaryphotos/, you know how it goes).
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 1
History 10
-
Anja Leichsenring commented and changed tracker
FeatureTask project id subjectImageViewHelper - Always render image in temp directoryAlways render image in temp directory category TYPO3 Version 7.0 <span data-processor="relativetime" data-value="2014-09-11T17:47:35+00:00" > 09/11/14, 17:47 </span>moved to Core, file handling is FAL domain.
-
Urs Braem commented <span data-processor="relativetime" data-value="2014-11-23T15:43:08+00:00" > 11/23/14, 15:43 </span>
I have experienced another use case for this, with TYPO3 6.2, which is simpler and probably more common:
- Editors keep an image archive in a non-public file storage (outside the root or protected by .htaccess) so that only used images will be accessible publicly.
- But if the image isn’t resized, TYPO3 will use the original link, e.g. private/image-archive/image.png
- As this storage isn’t public – the image won’t be displayed!
-
Stefan Neufeind commented and changed TYPO3 Version
7.07 <span data-processor="relativetime" data-value="2015-08-02T20:22:44+00:00" > 08/02/15, 20:22 </span>It would be great to have choice to always force processing of an image and never use the original one. One reason might be that you have jpegs with 100% quality and want them to be re-compressed according to your TYPO3-configured quality-settings.
-
Stefan Neufeind commented <span data-processor="relativetime" data-value="2015-08-02T20:31:53+00:00" > 08/02/15, 20:31 </span>
dirty/slow workaround: rotate the image, so it needs to be re-processed
file {
…
params = -rotate 360
}http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Imgresource/
-
Søren Andersen commented <span data-processor="relativetime" data-value="2015-08-16T21:16:50+00:00" > 08/16/15, 21:16 </span>
This is an issue for me also.
I use Dropbox as the default storage, because I want to store a lot of original images.
However, the Dropbox FAL driver is slow to process images, so I always want to serve the image from the processed folder, located in fileadmin.
Currently in the news ext, my images are simply not served, if they haven’t been processed, due to a bug serving a wrong URL from fileadmin.
But please include this in 6.2 if possible, don’t wait until 7.
UPDATE – after spending hours looking for a clean solution:
I gave up on the clean solution, for anyone looking for a dirty solution, I ended up Xclass’ing the Extbase ImageService, following Stefans suggestion above:class ImageService extends \TYPO3\CMS\Extbase\Service\ImageService { /** * Does exactly the same as the class it extends EXCEPT it ALWAYS creates a file * * @param File|FileReference $image * @param array $processingInstructions * @return ProcessedFile * @api */ public function applyProcessingInstructions($image, $processingInstructions) { $processingInstructions['additionalParameters'] = '-rotate 360'; return parent::applyProcessingInstructions($image, $processingInstructions); } }Remember to namespace the class and add something like this in ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Extbase\\Service\\ImageService'] = array( 'className' => 'YourVendorname\\Extensionkey\\Utility\\ImageService' );
A very ugly solution, but it works, now all my images rendered with f:image, ends up in the processed folder.
-
Pascal Dürsteler commented <span data-processor="relativetime" data-value="2016-07-18T22:05:43+00:00" > 07/18/16, 22:05 </span>
Another use case we are just working around with the hack from Stefan (thanks!): AdBlock Plus may block images having certain words in their path, despite the images not being ads at all and thus should not be blocked. Having a processed file is a remedy for this problem, as the file- and folder name is changed.
Watch out if you use animated gifs, which will break if you’re not excluding them.
-
Susanne Moog changed tracker
TaskFeature <span data-processor="relativetime" data-value="2019-03-03T14:05:29+00:00" > 03/03/19, 14:05 </span> -
Christian Hackl changed Related to #88954 <span data-processor="relativetime" data-value="2019-08-26T00:47:57+00:00" > 08/26/19, 00:47 </span>
-
Benni Mack commented and changed status
NewClosed <span data-processor="relativetime" data-value="2025-03-27T20:36:55+00:00" > 03/27/25, 20:36 </span>if we do this by default, this would make all server loads go up, because so many pictures need to be processed.
We had this with deferred_image_processing… which might be a good idea to start with and use that one, as it solves these problems.
In times of using multiple image formats, imgproxy etc. I suggest to use an extension to change the URL (you can use a different base url for images, so they are processed through a third-party).
Ah sorry for the typos – I thought it was possible to re-edit a post now, but the button seems to be gone again – or was never there