Project

General

Profile

Actions

Bug #44571

closed

FE pdf thumbnail generation fails

Added by Markus Timtner over 11 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Image Cropping
Target version:
-
Start date:
2013-01-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

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.


Files

csm_Anfahrt_Wuerzburg_416d1df11e.pdf (22.9 KB) csm_Anfahrt_Wuerzburg_416d1df11e.pdf renamed to pdf, working fine. Markus Timtner, 2013-01-16 15:19
csm_Anfahrt_Wuerzburg_416d1df11e.png (22.9 KB) csm_Anfahrt_Wuerzburg_416d1df11e.png original created file Markus Timtner, 2013-01-16 15:19
PDFtoPNG.jpg (341 KB) PDFtoPNG.jpg The generated png cannot be load Eric Chavaillaz, 2013-01-31 11:56
pdf-2page-demo.pdf (8.62 KB) pdf-2page-demo.pdf Markus Timtner, 2013-02-04 19:56

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #46530: Crop-Scaled images have wrong file content typeClosed2013-03-292013-03-29

Actions
Related to TYPO3 Core - Bug #62053: frame option in contentObject IMAGE ignoredClosed2014-10-06

Actions
Actions #1

Updated by Jigal van Hemert over 11 years ago

  • Assignee 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.

Actions #2

Updated by Markus Timtner over 11 years ago

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

Actions #3

Updated by Markus Timtner over 11 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.

Actions #4

Updated by Bernd Trippel about 11 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.

Actions #5

Updated by Max Roesch about 11 years ago

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

Actions #6

Updated by Eric Chavaillaz about 11 years ago

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)

Thanks!
Eric

Actions #7

Updated by Julian Hofmann about 11 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...

Actions #8

Updated by Julian Hofmann about 11 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];
                    }
                }
            }

Actions #9

Updated by Markus Timtner about 11 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.

Actions #10

Updated by Markus Timtner about 11 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??

Actions #11

Updated by Markus Hölzle about 11 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'];
if(!$processingConfiguration['fileExtension']){
    $processingConfiguration['fileExtension'] = 'web';
}

Actions #12

Updated by Oliver Hader about 11 years ago

  • Status changed from New to Needs Feedback
  • Assignee 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.

Actions #13

Updated by Tim Eilers almost 11 years ago

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

Actions #14

Updated by Lukas Krieger almost 11 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

Actions #15

Updated by Alexander Opitz almost 11 years ago

  • Status changed from Needs Feedback to New
Actions #16

Updated by Felix Jacobi about 10 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.

Actions #17

Updated by Marti McFlight over 9 years ago

Yes, this still happens in 6.2.8 :-(

Actions #18

Updated by Anonymous about 9 years ago

Still an issue in 6.2.11.

Actions #19

Updated by André Wuttig over 8 years ago

Still an issue in 6.2.14

Actions #20

Updated by Mathias Schreiber over 8 years ago

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

Updated by Georg Ringer over 8 years ago

  • Status changed from New to Resolved

this line has been added with #62053

Actions #22

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF