public static function display_image_attach($file, $width = 50, $height = 50, $rel = "")
{
$size = @getimagesize(INFUSIONS . "forum/attachments/" . $file);
if ($size[0] > $height || $size[1] > $width) {
if ($size[0] < $size[1]) {
$img_w = round($size[0] * $width / $size[1]);
$img_h = $width;
} elseif ($size[0] > $size[1]) {
$img_w = $height;
$img_h = round($size[1] * $height / $size[0]);
} else {
$img_w = $height;
$img_h = $width;
}
} else {
$img_w = $size[0];
$img_h = $size[1];
}
$res = "<a target='_blank' href='" . INFUSIONS . "forum/attachments/" . $file . "' rel='attach_" . $rel . "' title='" . $file . "'><img class='img-thumbnail' src='" . INFUSIONS . "forum/attachments/" . $file . "' alt='" . $file . "' style='border:0px; width:" . $img_w . "px; height:" . $img_h . "px;' /></a>\n";
return $res;
}