How to Change Image Preview Ratio
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 22
- Joined: 10 Oct 2024, 12:51
How to Change Image Preview Ratio
Hello, in version 2024 the preview configuration has been moved. Some of my images are no longer scaled 4/3 but 3/4.
I have tried in my extension under config/mshop/media.php
to overwrite:
I have tried in my extension under config/mshop/media.php
to overwrite:
I also ran the scale planner and set “--ai-product-image-ratio” to 4/3 in the backend settings, but like 60% of the images are wrong scale<?php
return array(
'manager' => array(
'previews' => [
'common' => [[
'maxwidth' => 960,
'maxheight' => 720,
'force-size' => 0,
]],
'catalog' => [
'stage' => [[
'maxwidth' => 960,
'maxheight' => 720,
'force-size' => 0,
]],
],
'product' => [[
'maxwidth' => 960,
'maxheight' => 720,
'force-size' => 0,
]],
],
),
);
Re: How to Change Image Preview Ratio
If you add that to the PHP config file, it's merged into the existing configuration. Then, it's only overwritten if the array key (0, 1, 2, 3) is the same. This doesn't apply if you set the configuration via TypoScript in the scheduler task and for the admin backend module.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 22
- Joined: 10 Oct 2024, 12:51
Re: How to Change Image Preview Ratio
Apparently it cannot find some pictures although they are available
Scaling media item "10035" failed: Couldn't read file "/uploads/tx_aimeos/1.d/files/f/3/f354eb3f_5x70.jpg"
Scaling media item "10035" failed: Couldn't read file "/uploads/tx_aimeos/1.d/files/f/3/f354eb3f_5x70.jpg"
Last edited by randomdennis on 18 Dec 2024, 14:58, edited 1 time in total.
-
- Posts: 22
- Joined: 10 Oct 2024, 12:51
Re: How to Change Image Preview Ratio
What I found is that in Scale/Standard.php, the rescale function always returns a path via getUrl() like this:
If I use this code in the scale function within typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/src/MShop/Media/Manager.php, it works:
However, for some items, I get paths like:files/e/a/ea5f2aee2c2ca9ee3e743f3a9cf8043e.png
These files are not found or read correctly./uploads/tx_aimeos/files/d/9/d96f61617ee606ba537b3f751a9e13c1.jpg
If I use this code in the scale function within typo3conf/ext/aimeos/Resources/Libraries/aimeos/aimeos-core/src/MShop/Media/Manager.php, it works:
I’m not sure if this is a specific issue just for us. Thanks again!if (strncmp($url, '/uploads/tx_aimeos/', 19) === 0) {
$url = substr($url, 19);
}