I'm trying to work out whether an image is landscape or portrait by inspecting the assets width and height properties. The image I'm inspecting is part of a set of assets (all images).

{{ assets:gallery_images }}
  {{ if first }}
      <img src="{{ url }}" class="w-full">
  {{ else }}
      <img src="{{ url }}" class="{{ if width > height }} h-full w-auto {{ else }} w-full h-auto {{ /if }}">
  {{ /if }}
{{ /assets:gallery_images }}

The problem I'm seeing is that the if statement always returns true or false depending on the dimensions of the first image. The dimensions of the remaining images are ignored.

Pretty sure I'm just missing something simple here but cannot work out what it is! Any help would be appreciated :)