I'm using Gallery to display images for an album on a page. I'm not using thumbnails just the main images. They are being resized to a fixed height of 600px but they all have variable width. I need to be able to pass the width value into the img width attribute in the thumbTpl.
Gallery call:
[[Gallery?
&imageHeight=`600`
&imageWidth=`0`
&thumbTpl=`galleryImages`
&toPlaceholder=`gallery`
]]thumbTpl:
<img src="[[+image]]" width="[[+need-width-here]]" height="600"/>
I have tried using a getImageSize snippet, this returns nothing, I've a feeling this is something to do with the image url generated by phpThumb. If I change the src to [ [+image_absolute]] then it works. However this is the incorrect width as the absolute image hasn't been run through phpThumb.
thumbTpl:
<img src="[[+image]]" width="[[getImageSize? &src=`[[+image]]`]]" height="600"/>
getImageSIze snippet
<?php
$imagesize = getimagesize("/some_path/" . $src);
$width = $imagesize[0]; // width
return $imagesize[0];
I've looked at running the image through phpThumbOf but can't get this to work either as I get an incorrect file path. Theres a few threads around about this:
https://forums.modx.com/thread/?thread=31377&page=1
https://forums.modx.com/thread/?thread=50628&page=1
Any ideas or workarounds?
Thanks!