Bug #44571
closedFE pdf thumbnail generation fails
Added by Markus Timtner almost 12 years ago. Updated about 6 years ago.
100%
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 |
Updated by Jigal van Hemert almost 12 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.
Updated by Markus Timtner almost 12 years ago
ok - sorry for that. Te issue still remains...
Updated by Markus Timtner almost 12 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.
Updated by Bernd Trippel almost 12 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.
Updated by Max Roesch almost 12 years ago
Just stumbled upon the same problem. So I confirm this bug.
Updated by Eric Chavaillaz almost 12 years ago
- File PDFtoPNG.jpg 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)
Thanks!
Eric
Updated by Julian Hofmann almost 12 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...
Updated by Julian Hofmann almost 12 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]; } } }
Updated by Markus Timtner almost 12 years ago
- File pdf-2page-demo.pdf pdf-2page-demo.pdf added
- % Done changed from 0 to 50
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.
Updated by Markus Timtner almost 12 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??
Updated by Markus Hölzle over 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'; }
Updated by Oliver Hader over 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.
Updated by Tim Eilers over 11 years ago
Had the same problem and using the current 6-0 branch helped!
Updated by Lukas Krieger over 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
Updated by Alexander Opitz over 11 years ago
- Status changed from Needs Feedback to New
Updated by Felix Jacobi over 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.
Updated by Marti McFlight about 10 years ago
Yes, this still happens in 6.2.8 :-(
Updated by Mathias Schreiber about 9 years ago
- Target version deleted (
6.0.5) - Is Regression set to No
Updated by Georg Ringer almost 9 years ago
- Status changed from New to Resolved
this line has been added with #62053