Forum
Can't scale images to a required maximum height
Hello,
I can't scale my images to a required maximum height (in this example 400 px). When I upload them into my Perch testpage, I see the correct dimensions next to the image field: 710 x 400 px @ 8KB. But when I'm refreshing the page, I don't see the correct result. I've tried it also without the crop="true". This is the testpage: https://studiowolf.be/test/autolusso/autolusso-exclusive-cars.php
<perch:repeater id="images" label="Images">
<li><img src="<perch:content type="image" id="image" label="Image" height="400" crop="true" />" alt="<perch:content type="text" id="alt" label="Description" />" /></li>
</perch:repeater>
Perch: 2.8.34, PHP: 7.0.13, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.34), assets (2.8.34), categories (2.8.34)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /test/autolusso/perch
PERCH_PATH: /home/studiowolf/domains/studiowolf.be/public_html/test/autolusso/perch
PERCH_CORE: /home/studiowolf/domains/studiowolf.be/public_html/test/autolusso/perch/core
PERCH_RESFILEPATH: /home/studiowolf/domains/studiowolf.be/public_html/test/autolusso/perch/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 6a33f95eca3667f9e0c39bf5ca2980fe
Resource folder writeable: Yes
SCRIPT_NAME: /test/autolusso/perch/core/settings/diagnostics/index.php
REQUEST_URI: /test/autolusso/perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/studiowolf/domains/studiowolf.be/public_html
HTTP_HOST: studiowolf.be
What size is the source image? Perch doesn't scale images up, only down.
There are different sizes, 99% is bigger. eg 1920x1080px, 1140x642px, 650x836px, 3264x2448, ...
In which case, that's no problem. Perch will scale the image down to 400px high.
Yes, but if you look at the image slider in this page: https://studiowolf.be/test/autolusso/autolusso-exclusive-cars.php The top image slider is coded in html. The second and third with Perch. You can see the second or third image changes in height a lot...
Both the images in the third slider are 400px tall, which is what you've asked Perch for.
Something in your front-end code is scaling the image for display in the browser. The file is the correct height.
CSS is indeed telling width=100%. If I drop this, the image slider doesn't fill up the whole space.
Right, but that's down to your front end code, so you'll need to find a solution. It's not something I can help with.