Example #1
0
File: pop.php Project: philum/cms
function place_image($doc, $media, $large, $largb, $txt = '', $com = '')
{
    $nl = substr($_SESSION['nl'], 0, 2);
    $nla = substr($media, 0, 2);
    $p['id'] = 'rez';
    if (substr($doc, 0, 4) == 'http') {
        if (eradic_acc($doc) == $doc) {
            $ok = joinable($doc);
        }
        if ($ok) {
            list($w, $h) = @getimagesize($doc);
        }
        if ($w > $large) {
            $w = $large;
        }
        return image($doc, $w, '', atr($p)) . "\n\n";
    } else {
        $pre = jcim($doc);
    }
    $dca = $pre . $doc;
    if ($nl or $nla == 'nl') {
        $http = host() . '/';
        $dca = str_replace('../', '', $dca);
    }
    if (file_exists($dca)) {
        list($w, $h) = getimagesize($dca);
        $_SESSION['lastimw'] = $w;
    }
    if (!$w && !$pre) {
        $dca = $doc;
        $w = $largb;
    }
    if ($media == "noimages") {
        return;
    } elseif ($media != "nlc") {
        //rss
        if (rstr(9)) {
            // && $com=''
            if ($w < $largb) {
                $p['style'] = 'float:left; margin-right:10px;';
            } else {
                $br = "\n\n";
            }
        } else {
            $br = "\n\n";
        }
        $p['src'] = $http . $dca;
        $re = '<img ' . atr($p) . ' />';
        $send = 'photo_' . str_replace("_", "*", $dca) . '_' . $w . '_' . $h;
        if ($txt && !$com) {
            $icon = picto('img') . ' ';
            if ($w && !$nl) {
                return ljb('', 'SaveBf', $send, $icon . $txt);
            } else {
                return lkt('', $dca, $txt);
            }
        }
        if ($w > $large && $large && !$com) {
            if ($nl or $nla == 'nl') {
                return $re . "\n\n";
            } else {
                return ljb('', 'SaveBf', $send, $re) . $br;
            }
        } elseif ($com) {
            $attrb = ' class="blocktext"';
            if ($w > $largb && ($nl or $nla == 'nl')) {
                return div($attrb, $re . $txt);
            } else {
                if ($w > $large) {
                    return ljb('', 'SaveBf', $send, $re) . div($attrb, $txt);
                } else {
                    return divc('clear', '') . div('style="width:' . $w . 'px;" ' . $attrb, $re . $txt);
                }
            }
        } else {
            return $re . $br;
        }
    }
}
Example #2
0
File: pop.php Project: philum/cms
function place_image($doc, $media, $large, $largb, $txt = '')
{
    $nl = substr($_SESSION['nl'], 0, 2);
    $nla = substr($media, 0, 2);
    $p['id'] = 'rez';
    if (substr($doc, 0, 4) == 'http') {
        if (eradic_acc($doc) == $doc) {
            $ok = joinable($doc);
        }
        if ($ok) {
            list($w, $h) = @getimagesize($doc);
        }
        if ($w > $large) {
            $w = $large;
        }
        return image($doc, $w, '', atr($p)) . "\n\n";
    } else {
        $pre = jcim($doc);
    }
    $dca = $pre . $doc;
    if ($nl or $nla == 'nl') {
        $http = host() . '/';
        $dca = str_replace('../', '', $dca);
    }
    if (file_exists($dca)) {
        list($w, $h) = getimagesize($dca);
    }
    if (!$w && !$pre) {
        $dca = $doc;
        $w = $largb;
    }
    if ($media == "noimages") {
        return;
    } elseif ($media != "nlc") {
        //rss
        if (rstr(17)) {
            $largb /= 2;
        }
        if (rstr(9) && !$com && $w < $largb) {
            $p['style'] = 'float:left; margin-right:10px;';
        }
        if ($w && $w < $largb) {
            $p['style'] .= ' width:' . $w . 'px;';
        }
        $p['src'] = $http . $dca;
        if (!rstr(9)) {
            $br = "\n\n";
        }
        //$h>40 or
        $ret = '<img ' . atr($p) . ' />';
        $send = 'photo_' . str_replace('_', '*', $dca) . '_' . $w . '_' . $h;
        if ($txt && !$com) {
            $icon = picto('img') . ' ';
            if ($w && !$nl) {
                return ljb('', 'SaveBf', $send, $icon . $txt);
            } else {
                return lkt('', $dca, $txt);
            }
        }
        if ($w > $large && $large && !$com) {
            if ($nl or $nla == 'nl') {
                return $ret . $br;
            } else {
                return ljb('', 'SaveBf', $send, $ret) . $br;
            }
        } else {
            return $ret . $br;
        }
    }
}