300 || $size[1] > 200) { if ($size[0] <= $size[1]) { $img_w = round(($size[0] * 200) / $size[1]); $img_h = 200; } else if ($size[0] > $size[1]) { $img_w = 300; $img_h = round(($size[1] * 300) / $size[0]); } else { $img_w = 300; $img_h = 200; } } else { $img_w = $size[0]; $img_h = $size[1]; } if ($size[0] != $img_w || $size[1] != $img_h) { $res = "".$file.""; } else { $res = "".$file.""; } return $res; } /** * Display attached image with a certain given width and height. * * @param $file * @param int $width * @param int $height * @param string $rel * * @return string */ public static function display_image_attach($file, $width = 50, $height = 50, $rel = "") { if (file_exists(INFUSIONS."forum/attachments/".$file)) { $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; } else if ($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 = "".$file."\n"; } else { $res = fusion_get_locale('forum_0188'); } return $res; } }