Project

General

Profile

Actions

Feature #59067

open

Always render image in temp directory

Added by Urs Braem almost 10 years ago. Updated about 5 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2014-05-23
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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).


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Feature #88954: force image processing per viewhelperNeeds Feedback2019-08-13

Actions
Actions #1

Updated by Urs Braem almost 10 years ago

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

Actions #2

Updated by Anja Leichsenring over 9 years ago

  • Tracker changed from Feature to Task
  • Project changed from 2559 to TYPO3 Core
  • Subject changed from ImageViewHelper - Always render image in temp directory to Always render image in temp directory
  • Category set to File Abstraction Layer (FAL)
  • TYPO3 Version set to 7.0

moved to Core, file handling is FAL domain.

Actions #3

Updated by Urs Braem over 9 years ago

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!
Actions #4

Updated by Stefan Neufeind over 8 years ago

  • TYPO3 Version changed from 7.0 to 7

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.

Actions #5

Updated by Stefan Neufeind over 8 years ago

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/

Actions #6

Updated by Søren Andersen over 8 years ago

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.

Actions #7

Updated by Pascal Dürsteler almost 8 years ago

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.

Actions #8

Updated by Susanne Moog about 5 years ago

  • Tracker changed from Task to Feature
Actions #9

Updated by Christian Hackl over 4 years ago

  • Related to Feature #88954: force image processing per viewhelper added
Actions

Also available in: Atom PDF