function resize_image($imghtml)
{
    global $maximgwidth;
    global $ftp;
    global $fopenIsSet;
    $imghtml = preg_replace('/style=\\"[^\\"]*\\"/', '', $imghtml);
    //get rid of inline style
    if (preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $imghtml, $matches)) {
        if (!empty($matches[1]) && verifyimage($matches[1])) {
            if ($fopenIsSet == 1) {
                $thisWidth = getimagesize($matches[1]);
            } else {
                $thisWidth = "150";
            }
            if ($ftp == 1 && $maximgwidth == 999) {
                return str_replace("<img", "<img", remove_img_hw($imghtml));
            } else {
                if ($thisWidth > $maximgwidth) {
                    return str_replace("<img", "<img width=\"" . $maximgwidth . "\"", remove_img_hw($imghtml));
                } else {
                    return str_replace("<img", "<img width=\"" . $thisWidth . "\"", remove_img_hw($imghtml));
                }
            }
        }
    }
}
Example #2
0
function rssmi_resize_image_for_shortcode($imghtml)
{
    global $maximgwidth;
    return str_replace("<img", "<img width=\"" . $maximgwidth . "\"", remove_img_hw($imghtml));
}