Bug #37928
Aspect ratio of images not respected
| Status: | Closed | Start date: | 2012-06-11 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | Christian Weiske | % Done: | 100% |
|
| Category: | - | Spent time: | 1.00 hour | |
| Target version: | - | Estimated time: | 1.00 hour | |
| Votes: | 1 (View) |
Description
I'm using imagecycle 2.6.4. Page has "Image-Cycle" and "Image-Cycle for tt_content" static templates included, and a imagecycle plugin on the frontpage. I've set the width to 620 and height to 300, images are from DAM.
Opening the frontend page, the images are distorted - their aspect ratio is not respected. The images look weird.
I think that imagecycle should use typo3's in-built methods to cut the matching target image in the correct ratio from the source image.
History
Updated by Juergen Furrer about 1 year ago
- Status changed from New to Needs Feedback
- Assignee set to Christian Weiske
Imagecycle uses the build in methods
What kind of cType and what settings did you use?
If you use Text/w Image, the images are rendered by css_styled_content and not by imagecycle
You cant define crop parameters in imagewidth and imageheight, only image pixel
Updated by James Poulson 12 months ago
I think I understand what Christian means and had the same effect while attempting to adjust images (squashed images on the y axis). If height/width ratio is relevant a solution would be to "letterbox" images. This can be done manually in GIMP by scaling an image down until one of the dimensions matches a constraint specified in the plugin, then by adjusting the image canvas with proportions unlocked to "clip" the resulting image to fit. I'm guessing this couldn't entirely be done programatically and would require some visual adjustment tool.
Updated by Christian Weiske 12 months ago
The ctype is "insert plugin" (or however this is called in english).
Plugin settings are as follows:
- Mode: DAM
- Width: 620
- Height: 340
- Random order
- Stop animation on mouseover
- Movement: fade
- Type of transition: linear
- Simultaneous animation
I don't know how imagecycle implements the scaling, but typo3 is able to scale and crop automatically, respecting the size:
$cObj->getImgResource(
$pathToImage,
array(
'width' => '200c-50',
'height' => '160c-50',
)
);
This makes the image 200x160 px in size, keeping aspect ratio and cropping when needed (that's what the "c" says"). The "-50" means it's centered.
The people that manage the content are not computer-affine enough to crop and scale the images manually, so I'd like to have an automatic solution.
Updated by Juergen Furrer 12 months ago
- Status changed from Needs Feedback to Accepted
- Estimated time set to 1.00
Now its more clear
I thought you mean "text/w image" because of the included static "Image-Cycle for tt_content"...
In this case, it would be possible, to add a new checkbox to the FlexForm to enable "crop and center"
This would add "c-50" to a numeric value in width and height.
Updated by Juergen Furrer 12 months ago
I found a better solution:
I wil add a new stdWraps to TS:
integerWidthWrap = |c-50 integerHeightWrap = |c-50
This will wrap all integer values
example:
width = 100 height = 100c
this new feature will output these values:
width = 100c-50 height = 100c
Updated by Juergen Furrer 12 months ago
- Status changed from Accepted to Closed
- % Done changed from 0 to 100