<?php foreach($ar as $k=>$v){ $size=getimagesize($v); if($size[0]>400||$size[1]>400){ $img = new image_sizer(); $img->setImage($v); $img->setSize(400, 400); $img->saveTo($v, 100); } echo' <img src="'.$v.'" class="preview" />'; } ?>
info at phpclasses dot org