Negative image width if first image is a png
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.
Updated by Martin Günther almost 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.
- 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
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 about 10 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 = 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
Typo3 Version 6.1.7
CSS Styled Content included in the not numbered version.
Are there any news about this bug?
Updated by Benni Mack about 9 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.