Gallerys automatically keeping aspect ratio

I would like my thumb images to have a fixed width with auto height based on aspect ratio.
Is this possible in a snippet call property?

There exist properties for the thumbnail settings like thumbZoomCrop, thumbFar, thumbWidth etc.
Take a look at the documentation.

You probably have to set &thumbZoomCrop=`0`

1 Like

Thanks, I will try that out.
Another question, does gallery support webp?

I think it should work.
Maybe not for all import methods (like “Batch Upload” or “Zip Upload”).

To output the thumbnails as WebP, you probably have to define the f parameter in the property “thumbProperties”.


It seems that thumbnails have a default size of 100 x 100 which I can change.
&thumbZoomCrop=0 will keep aspect ratio but add white space to match &thumbWidth and default height.
The only other propertys are &thumbfar and &thumbProperties.
&thumbfar only moves the image inside the dimensions.
The aspect ratio for phpThumb with the thumbnail. The image is created at size specified by “w” and “h” (which must both be set). Values are the alignment: L=left,R=right,T=top,B=bottom,C=center. Set to BL,BR,TL,TR to specify for landscape or portrait images.
Cannot find a list of options for &thumbProperties.

Have tried your suggestion.

<img src="/assets/components/gallery/connector.php?
src=%2Fassets%2Fgallery%2F3%2F13.jpg" alt="">

It still has the jpg extension.
I have looked on the phpthumb website

Does it work if you set the height to zero? → &thumbHeight=`0`

There is a list of phpThumb parameters in the readme on Github:

Settiing height to 0 worked.
I do not know if I can use webp?
I have looked into phpThumbsUp, phpThumbOn and pThumb for webp support.

All these extras (basically) use the same phpThumb library that comes with MODX (and is also used by Gallery).
If WebP doesn’t work, then either your MODX version is too old, or maybe the graphics libraries installed on the server don’t support WebP.

modx 3.0.1 and just updated php to 8.2.
I use Krystal hosting on a shared server and they do not see a problem.

So when you request this URL (while being logged in to the manager)

what is the response image?
Is it of type WebP?

How do I request this url?

Just copy the URL into the address bar of the browser and change to the actual domain of your site.

The connector connectors/system/phpthumb.php is used in MODX for the thumbnails (for example in the media browser). Also make sure that the “src” parameter (src=assets%2Fgallery%2F3%2F13.jpg) points to an existing image file (assets/gallery/3/13.jpg in this example).

It’s just to check if there is a general problem with WebP on your installation or only with the Gallery extra.

I pasted this in the url

raw data


Are you logged in to the manager?

Yes but on split screen

Tab on same window, same result.

Maybe the connector needs the &HTTP_MODAUTH=... parameter for the authorization.

Just go to the Media Browser (Menu “Media” → “Media Browser”), copy the URL of a thumbnail and change &f=png to &f=webp, then check if you get a WebP image back.

Where do I find thumbnails

In the Media Browser (manager/?a=media/browser), navigate to a folder that contains an image.
The Media Browser shows a thumbnail of the image.

Open the browser’s developer tools → tab “Inspector” → copy the thumbnail URL. (It has the form connectors/system/phpthumb.php?src=...)