phpthumbOn

<div class="col-md-3 gallitem">
    <a href="[[~[[+id]]]]" >
        <img class="img-thumbnail galpic"  src="[[!phpthumbon? &input=`[[+tv.gimage]]` &options=`&w=400&h=400&zc=1`]]">
    </a>
</div>

gimage - Output=Text