Bug #44571

FE pdf thumbnail generation fails

Added by Markus Timtner about 4 years ago. Updated about 1 year ago.

Status:Resolved Start date:2013-01-16
Priority:Must have Due date:
Assigned To:Oliver Hader % Done:


Category:Image Generation Spent time: -
Target version:-
TYPO3 Version:6.0 Complexity:medium
PHP Version:5.3 Is Regression:No
Tags: Sprint Focus:


In a fresh 6.0 install, the FE pdf thumbnail generation for the content element "filelinks" with layout>1 fails.
A png file is created, but the file itself is a pdf, see the specimen attached.

The proposed fix here: https://review.typo3.org/#/c/17208/ does not work for this.

However, in the BE, pdf thumbnail creation is working fine.

I verfified this bahaviour in two fresh 6.0 instances.

csm_Anfahrt_Wuerzburg_416d1df11e.pdf - renamed to pdf, working fine. (22.9 kB) Markus Timtner, 2013-01-16 15:19

csm_Anfahrt_Wuerzburg_416d1df11e.png - original created file (22.9 kB) Markus Timtner, 2013-01-16 15:19

PDFtoPNG.jpg - The generated png cannot be load (341 kB) Eric Chavaillaz, 2013-01-31 11:56

pdf-2page-demo.pdf (8.6 kB) Markus Timtner, 2013-02-04 19:56

Related issues

related to Core - Bug #46530: Crop-Scaled images have wrong file content type Resolved 2013-03-29 2013-03-29
related to Core - Bug #62053: frame option in contentObject IMAGE ignored Resolved 2014-10-06


#1 Updated by Jigal van Hemert about 4 years ago

  • Assigned To deleted (Helmut Hummel)

Please don't assign issues to people. People will assign an issue to themselves if they start working on it and if an issue seems to be assigned to someone others will not work on it.

#2 Updated by Markus Timtner about 4 years ago

ok - sorry for that. Te issue still remains...

#3 Updated by Markus Timtner about 4 years ago

I also verified this Issue on demo.typo3.org

Steps to reproduce:

Create an element "filelinks"
Create new file relation to a pdf (BE thumbnail creation is working fine!)
Choose > Appearance > Layout > "Layout 2"

See that the frontend thumbnail is broken. A png file is created, but in fact it is the resized pdf-file with wrong fileext.

#4 Updated by Bernd Trippel about 4 years ago

Can confirm it. BE creation of thumbnail works, in FE a png file is created, it's the pdf-file with wrong png file-extension.
php 5.4.11/fast-cgi and graphicsmagick.

#5 Updated by Max Roesch about 4 years ago

Just stumbled upon the same problem. So I confirm this bug.

#6 Updated by Eric Chavaillaz about 4 years ago

  • File PDFtoPNG.jpg added
  • Target version changed from 6.0.1 to 6.0.2

In my installation (TYPO3 6.0.1), the bug is for all images from PDF.

I upload a PDF to show it as an image in the frontend but nothing appear. However in the backend the thumb is generated well.

In the frontend the img tag is created but the source is not readable. (see attachment)


#7 Updated by Julian Hofmann about 4 years ago

Without an extension, the PDF will neither scaled nor displayed:

page.30 = IMAGE
page.30.file = fileadmin/some.pdf
page.30.file.width = 250

If you define an extension for the processed file, you get a correct scaled image:

page.30 = IMAGE
page.30.file = fileadmin/some.pdf
page.30.file.ext = png
page.30.file.width = 250

Seems, the case of PDFs is missing in: TYPO3\CMS\Core\Imaging::imageMagickConvert()

Perhaps I'll find some time this weekend for more debugging...

#8 Updated by Julian Hofmann about 4 years ago

In the past the extension for the new file was set to "web" in tslib_cObj::getImgResource() around line 5025 if you do not have defined one:

if (!trim($fileArray['ext'])) {
  $fileArray['ext'] = 'web';

Now, in version 6.0, the new extension is set to the original file extension, if you do not explicit define one (TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource() aroubnd line 5080):

$processingConfiguration['fileExtension'] = isset($fileArray['ext.']) ? $this->stdWrap($fileArray['ext'], $fileArray['ext.']) : $fileArray['ext'];

This cases imageMagickConvert() to neither set a new extension (because it is not empty) nor to set one based on "web", but to use the given: "pdf" - the originals file extension.

            if (!$newExt) {
                $newExt = $info[2];
            if ($newExt == 'web') {
                if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList($this->webImageExt, $info[2])) {
                    $newExt = $info[2];
                } else {
                    $newExt = $this->gif_or_jpg($info[2], $info[0], $info[1]);
                    if (!$params) {
                        $params = $this->cmds[$newExt];

#9 Updated by Markus Timtner about 4 years ago

Hi Julian,

first of all, kudos and thanks for your efforts!

Setting the

"...file.ext = png"
explicitly, seems to work for one-page pdfs.

If there are more pages, there still seems to be missing the "frame" parameter...
In this case only a pdf with dimensions 0x0 is generated.
[ see http://forge.typo3.org/issues/21983 for details. ]

But whre to set this paramter now?

Kind regards, mt.

#10 Updated by Markus Timtner about 4 years ago

  • % Done changed from 50 to 100

in case of multipage pdfs, you have to be sure that im_noFramePrepended is set to null.

[GFX][im_noFramePrepended] = 0

In case of filelinks|layout=2 is used, you have to include

tt_content.uploads.20.renderObj.10.file.ext = png

in your setup.

But how to include this in a patch??

#11 Updated by Markus Hölzle almost 4 years ago

  • Target version changed from 6.0.2 to 6.0.5

Problem already exists if using Fluid to render PDF:

<f:image src="{pathToPdf}" maxWidth="80" maxHeight="120" alt="" />

I solved it this way:
In \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::getImgResource (Line 5091)

$processingConfiguration['fileExtension'] = isset($fileArray['ext.']) ? $this->stdWrap($fileArray['ext'], $fileArray['ext.']) : $fileArray['ext'];
    $processingConfiguration['fileExtension'] = 'web';

#12 Updated by Oliver Hader almost 4 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Oliver Hader
  • Complexity set to medium

Please test again with current Git version of TYPO3_6-0 branch.
The issue has been solved for regular images in issue #46530 - it should be working for PDF files as well.

#13 Updated by Tim Eilers almost 4 years ago

Had the same problem and using the current 6-0 branch helped!

#14 Updated by Lukas Krieger over 3 years ago

Here is a fix for the missing "file.frame" parameter

In the file "ContentObjectRenderer.php" (typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php)
Line 5156-5164:

$processingConfiguration['width'] = isset($fileArray['width.']) ? $this->stdWrap($fileArray['width'], $fileArray['width.']) : $fileArray['width'];
                    $processingConfiguration['height'] = isset($fileArray['height.']) ? $this->stdWrap($fileArray['height'], $fileArray['height.']) : $fileArray['height'];
                    $processingConfiguration['fileExtension'] = isset($fileArray['ext.']) ? $this->stdWrap($fileArray['ext'], $fileArray['ext.']) : $fileArray['ext'];
                    $processingConfiguration['maxWidth'] = isset($fileArray['maxW.']) ? intval($this->stdWrap($fileArray['maxW'], $fileArray['maxW.'])) : intval($fileArray['maxW']);
                    $processingConfiguration['maxHeight'] = isset($fileArray['maxH.']) ? intval($this->stdWrap($fileArray['maxH'], $fileArray['maxH.'])) : intval($fileArray['maxH']);
                    $processingConfiguration['minWidth'] = isset($fileArray['minW.']) ? intval($this->stdWrap($fileArray['minW'], $fileArray['minW.'])) : intval($fileArray['minW']);
                    $processingConfiguration['minHeight'] = isset($fileArray['minH.']) ? intval($this->stdWrap($fileArray['minH'], $fileArray['minH.'])) : intval($fileArray['minH']);
                    $processingConfiguration['noScale'] = isset($fileArray['noScale.']) ? $this->stdWrap($fileArray['noScale'], $fileArray['noScale.']) : $fileArray['noScale'];
                    $processingConfiguration['additionalParameters'] = isset($fileArray['params.']) ? $this->stdWrap($fileArray['params'], $fileArray['params.']) : $fileArray['params'];

Just add this row and the frame parameter will be delivered to the imageMagickExec function

$processingConfiguration['frame'] = isset($fileArray['frame.']) ? intval($this->stdWrap($fileArray['frame'], $fileArray['frame.'])) : intval($fileArray['frame']);

Tested on the newest Typo3 version 6.1.1

#15 Updated by Alexander Opitz over 3 years ago

  • Status changed from Needs Feedback to New

#16 Updated by Felix Jacobi almost 3 years ago

Can anyone else confirm that this is still happening with 6.2 and the patch above is not working anymore?

Switched a page in development from 6.1.7 (with the patch above) and working PDF thumbs to 6.2.0 and it stopped working.
Seems like this is still an issue.

#17 Updated by Martin Eberle about 2 years ago

Yes, this still happens in 6.2.8 :-(

#18 Updated by Mark Howells-Mead almost 2 years ago

Still an issue in 6.2.11.

#19 Updated by André Wuttig over 1 year ago

Still an issue in 6.2.14

#20 Updated by Mathias Schreiber over 1 year ago

  • Target version deleted (6.0.5)
  • Is Regression set to No

#21 Updated by Georg Ringer about 1 year ago

  • Status changed from New to Resolved

this line has been added with #62053

Also available in: Atom PDF