I'd like to wrap photos in the singleBody view in a <div> with fixed width. Now the question is, how to get the actual width of the photo that gets displayed. From the smarty debug info, I constructed the following:
... inside singleBody.tpl:
{$layout.imageViews[$layout.imageViewsIndex].width}
That works for now, but is this method safe to use (e.g. are there situations where the $imageViews array is empty?).
Thanks,
Christian
Posts: 8601
It could be empty, but unlikely as it will even show you the thumbnail if you don't have permission to view full size or resizes. But another possibility is a non-image so there is no ".wdith". Look at the top of the tpl where it makes a shortcut to $layout.imageViews[$layout.imageViewsIndex] and assigns it to "image".. you can use {if !empty($image.width)} .... {$image.width} .... {/if}