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));
                }
            }
        }
    }
}
Ejemplo n.º 2
0
function rssmi_resize_image($imghtml)
{
    $rssmi_global_options = get_option('rssmi_global_options');
    $noImageSize = isset($rssmi_global_options['noImageSize']) ? $rssmi_global_options['noImageSize'] : 0;
    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 && rssmi_remoteFileExists($matches[1])) {
                ///just deleted this
                if ($noImageSize != 1) {
                    $imageArray = getimagesize($matches[1]);
                }
                if (!empty($imageArray)) {
                    $thisWidth = $imageArray[0];
                } else {
                    $thisWidth = "150";
                }
            } else {
                ///just deleted this
                $thisWidth = "150";
            }
            ///just deleted this
            if ($ftp == 1 && $maximgwidth == 999) {
                $returnImage = str_replace("<img", "<img", remove_img_hw($imghtml));
            } else {
                if ($thisWidth > $maximgwidth) {
                    $returnImage = str_replace("<img", "<img width=\"" . $maximgwidth . "\"", remove_img_hw($imghtml));
                } else {
                    $returnImage = str_replace("<img", "<img width=\"" . $thisWidth . "\"", remove_img_hw($imghtml));
                }
            }
        }
    }
    return $returnImage;
}