Bug #37597
closedNegative image width if first image is a png
0%
Description
How to reproduce:
Select a content element of type "Image" and add e.g. 3 images. If the first image is a png and the other two images are jpgs, the image size of the first image is negative. Don't select a width or height and set the number of columns to 3.
If you move one of the jpg images to the first position, the image width is calculated correctly.
This happens in version 4.5.15 and in the current master.
I searched in class.tx_cssstyledcontent_pi1.php for a while, but I am not sure how to solve this. I will push a patch to review in a couple of minutes, but my guess is, that this is not enough to fix this correctly.
Files
Updated by Gerrit Code Review over 12 years ago
- Status changed from New to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11714
Updated by Thomas Layh over 12 years ago
PHP Version: 5.3.10
GraphicsMagick 1.3.12
Updated by Martin Günther over 11 years ago
- File first-image-png-negative-width.png first-image-png-negative-width.png added
- File first-image-jpg-not-scaled.png first-image-jpg-not-scaled.png added
- File one-image-per-row-first-png.png one-image-per-row-first-png.png added
- File one-image-per-row-first-jpg.png one-image-per-row-first-jpg.png added
I'm currently having (almost) the same issue.
The first image has a negative width when .png.
If first image is .jpeg it gets scaled to size of original image. Width is set to original image width.
This always concerns only the first image of a row if there are more than one images in a row. It does not make a difference there if 2, 3, 4, ... images per Row. Always the first image has a negativ width if .pgn: width="-10px" when 2 images in row, "-20px" when 3, "-30px" when 4 images in a row, ...
If .jpeg width is same as original image.
Other findings:
- first .png image get's scaled to size of original even if it should not get sclaed. Result: negative width. If I set "Quality & Type" from "default" to "none" everything is fine. First image does not get scaled anymore and width is correct.
- If first image .jpg and should get scaled because of maxWidth / MaxHeight it gets scaled to original dimensions. width = width of original image.
- If only one image per row everything is fine.
- I tested older static CSS Styled Content templates: the "problem" does not occur with CSS Styled Content TYPO3 v3.8.
Typo3 Version 4.5.25
PHP: 5.2.17
ImageMagick: Thaught it is an ImageMagick issue, so I tested 4.2.9 (static), 6.5.9 (static), 6.6.0-4 --> same result with all tested versions
Hope this helps. Let me know if I can help.
Updated by Christian Althoff almost 11 years ago
This issue occured at my installation again. As described by Martin Günther the first image in a row gets scaled to its original size. In my installation it does not matter if a png is uploaded, I just added three jpgs for testing and it still shows the behaviour. Also it is always the first picture in a row not depending on how many pics per row you set.
The following Typoscript scales and crops all other pictures correctly:
tt_content.image.20.1.file.width.field >
tt_content.image.20.1.file.width = 220c
tt_content.image.20.1.file.height = 180c
tt_content.image.20.1.file.width.override.field = imagewidth
tt_content.image.20.1.file.height.override.field = imageheight
tt_content.image.20.equalH >
tt_content.image.20.equalW >
Typo3 Version 6.1.7
PHP 5.3.19
GraphicsMagick 1.2.7
CSS Styled Content included in the not numbered version.
Are there any news about this bug?
Updated by Gerrit Code Review almost 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/11714
Updated by Benni Mack almost 10 years ago
- Status changed from Under Review to Needs Feedback
- Assignee set to Benni Mack
- Is Regression set to No
Sorry, I really cannot reproduce this issue. I suggest you checkout the patch from Thomas and see if this fixes your problem, if so, please vote for it. Or give me an installation where I can verify this. I really want to help you but it's hard if I cannot reproduce this problem.
Updated by Benni Mack almost 10 years ago
- Target version set to next-patchlevel
Any update from any reporter about this issue would be great, otherwise I will close this issue and mark it as "not reproducable".
Updated by Benni Mack over 9 years ago
- Status changed from Needs Feedback to Rejected
cannot reproduce in 6.2 or 7, thus will be closed. if you can help me reproduce this one, feel free to contact me via benni@typo3.org _ I can then open up this issue again.