Image transforms getting applied even when image is smaller than the transform's width
I think you're confusing the "Width" setting to mean "Max Width", which it doesn’t. The image will get sized to match your transform's Width setting, regardless of whether it's bigger or smaller than that width beforehand.

If you want to conditionally apply the transform, only if it's larger than the transform's width, you can do this:

{% if asset.width &gt; asset.getWidth('detail') %}
    {% do asset.setTransform('detail') %}
{% endif %}

&lt;img src="{{ asset.url }}" alt="{{ asset.title }}" class="{% if block.position in ['left'] %}pull-left{% endif %}"&gt;