当前位置: 首页>>代码示例>>PHP>>正文


PHP image::Thumb方法代码示例

本文整理汇总了PHP中image::Thumb方法的典型用法代码示例。如果您正苦于以下问题:PHP image::Thumb方法的具体用法?PHP image::Thumb怎么用?PHP image::Thumb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


在下文中一共展示了image::Thumb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: common

 function common()
 {
     global $_G;
     if (empty($_G['uid'])) {
         self::error('api_uploadavatar_unavailable_user');
     }
     if (empty($_FILES['Filedata'])) {
         self::error('api_uploadavatar_unavailable_pic');
     }
     list($width, $height, $type, $attr) = getimagesize($_FILES['Filedata']['tmp_name']);
     $imgtype = array(1 => '.gif', 2 => '.jpg', 3 => '.png');
     $filetype = $imgtype[$type];
     if (!$filetype) {
         $filetype = '.jpg';
     }
     $avatarpath = $_G['setting']['attachdir'];
     $tmpavatar = $avatarpath . './temp/upload' . $_G['uid'] . $filetype;
     file_exists($tmpavatar) && @unlink($tmpavatar);
     if (@copy($_FILES['Filedata']['tmp_name'], $tmpavatar) || @move_uploaded_file($_FILES['Filedata']['tmp_name'], $tmpavatar)) {
         @unlink($_FILES['Filedata']['tmp_name']);
         list($width, $height, $type, $attr) = getimagesize($tmpavatar);
         if ($width < 10 || $height < 10 || $type == 4) {
             @unlink($tmpavatar);
             self::error('api_uploadavatar_unusable_image');
         }
     } else {
         @unlink($_FILES['Filedata']['tmp_name']);
         self::error('api_uploadavatar_service_unwritable');
     }
     $tmpavatarbig = './temp/upload' . $_G['uid'] . 'big' . $filetype;
     $tmpavatarmiddle = './temp/upload' . $_G['uid'] . 'middle' . $filetype;
     $tmpavatarsmall = './temp/upload' . $_G['uid'] . 'small' . $filetype;
     $image = new image();
     if ($image->Thumb($tmpavatar, $tmpavatarbig, 200, 250, 1) <= 0) {
         //$image->error();
         self::error('api_uploadavatar_unusable_image');
     }
     if ($image->Thumb($tmpavatar, $tmpavatarmiddle, 120, 120, 1) <= 0) {
         //$image->error();
         self::error('api_uploadavatar_unusable_image');
     }
     if ($image->Thumb($tmpavatar, $tmpavatarsmall, 48, 48, 2) <= 0) {
         //$image->error();
         self::error('api_uploadavatar_unusable_image');
     }
     $this->tmpavatar = $tmpavatar;
     $this->tmpavatarbig = $avatarpath . $tmpavatarbig;
     $this->tmpavatarmiddle = $avatarpath . $tmpavatarmiddle;
     $this->tmpavatarsmall = $avatarpath . $tmpavatarsmall;
 }
开发者ID:sayhanabi,项目名称:sayhanabi_forum,代码行数:50,代码来源:uploadavatar.php

示例2: common

 function common()
 {
     global $_G;
     if (!defined('IN_DISCUZ') || empty($_GET['aid']) || empty($_GET['size']) || empty($_GET['key'])) {
         header('location: ' . $_G['siteurl'] . 'static/image/common/none.gif');
         exit;
     }
     $allowsize = array('960x960', '268x380', '266x698', '2000x2000');
     if (!in_array($_GET['size'], $allowsize)) {
         header('location: ' . $_G['siteurl'] . 'static/image/common/none.gif');
         exit;
     }
     $nocache = !empty($_GET['nocache']) ? 1 : 0;
     $daid = intval($_GET['aid']);
     $type = !empty($_GET['type']) ? $_GET['type'] : 'fixwr';
     list($w, $h) = explode('x', $_GET['size']);
     $dw = intval($w);
     $dh = intval($h);
     $thumbfile = 'image/' . $daid . '_' . $dw . '_' . $dh . '.jpg';
     $parse = parse_url($_G['setting']['attachurl']);
     $attachurl = !isset($parse['host']) ? $_G['siteurl'] . $_G['setting']['attachurl'] : $_G['setting']['attachurl'];
     if (!$nocache) {
         if (file_exists($_G['setting']['attachdir'] . $thumbfile)) {
             dheader('location: ' . $attachurl . $thumbfile);
         }
     }
     define('NOROBOT', TRUE);
     $id = !empty($_GET['atid']) ? $_GET['atid'] : $daid;
     if (md5($id . '|' . $dw . '|' . $dh) != $_GET['key']) {
         dheader('location: ' . $_G['siteurl'] . 'static/image/common/none.gif');
     }
     if ($attach = C::t('forum_attachment_n')->fetch('aid:' . $daid, $daid, array(1, -1))) {
         if (!$dw && !$dh && $attach['tid'] != $id) {
             dheader('location: ' . $_G['siteurl'] . 'static/image/common/none.gif');
         }
         dheader('Expires: ' . gmdate('D, d M Y H:i:s', TIMESTAMP + 3600) . ' GMT');
         if ($attach['remote']) {
             $filename = $_G['setting']['ftp']['attachurl'] . 'forum/' . $attach['attachment'];
         } else {
             $filename = $_G['setting']['attachdir'] . 'forum/' . $attach['attachment'];
         }
         require_once libfile('class/image');
         $img = new image();
         if ($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
             if ($nocache) {
                 dheader('Content-Type: image');
                 @readfile($_G['setting']['attachdir'] . $thumbfile);
                 @unlink($_G['setting']['attachdir'] . $thumbfile);
             } else {
                 dheader('location: ' . $attachurl . $thumbfile);
             }
         } else {
             dheader('Content-Type: image');
             @readfile($filename);
         }
     }
     exit;
 }
开发者ID:sayhanabi,项目名称:sayhanabi_forum,代码行数:58,代码来源:forumimage.php

示例3: foreach

    $upload->init($_FILES['attach'], 'portal');
    $attach = $upload->attach;
    if (!$upload->error()) {
        $upload->save();
    }
    if ($upload->error()) {
        portal_upload_error($upload->error());
    }
    $attachs[] = $attach;
}
if ($attachs) {
    foreach ($attachs as $attach) {
        if ($attach['isimage']) {
            require_once libfile('class/image');
            $image = new image();
            $attach['thumb'] = $image->Thumb($attach['target'], '', '300', '300', 2);
            $image->Watermark($attach['target']);
        }
        if (getglobal('setting/ftp/on')) {
            if (ftpcmd('upload', 'portal/' . $attach['attachment'])) {
                if ($attach['thumb']) {
                    ftpcmd('upload', 'portal/' . $attach['attachment'] . '.thumb.jpg');
                }
                $attach['remote'] = 1;
            } else {
                if (getglobal('setting/ftp/mirror')) {
                    @unlink($attach['target']);
                    @unlink($attach['target'] . '.thumb.jpg');
                    portal_upload_error(lang('portalcp', 'upload_remote_failed'));
                }
            }
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:31,代码来源:portalcp_upload.php

示例4: stream_save

function stream_save($strdata, $albumid = 0, $fileext = 'jpg', $name = '', $title = '', $delsize = 0, $from = false)
{
    global $_G, $space;
    if ($albumid < 0) {
        $albumid = 0;
    }
    $setarr = array();
    require_once libfile('class/upload');
    $upload = new discuz_upload();
    $filepath = $upload->get_target_dir('album') . $upload->get_target_filename('album') . '.' . $fileext;
    $newfilename = $_G['setting']['attachdir'] . './album/' . $filepath;
    if ($handle = fopen($newfilename, 'wb')) {
        if (fwrite($handle, $strdata) !== FALSE) {
            fclose($handle);
            $size = filesize($newfilename);
            if (empty($space)) {
                $_G['member'] = $space = getspace($_G['uid']);
                $_G['username'] = addslashes($space['username']);
            }
            $_G['member'] = $space;
            $maxspacesize = checkperm('maxspacesize');
            $maxspacesize = $maxspacesize * 1024 * 1024;
            if ($maxspacesize) {
                space_merge($space, 'common_member_count');
                space_merge($space, 'common_member_field_home');
                if ($space['attachsize'] + $size - $delsize > $maxspacesize + $space['addsize']) {
                    @unlink($newfilename);
                    return -1;
                }
            }
            if (!$upload->get_image_info($newfilename)) {
                @unlink($newfilename);
                return -2;
            }
            require_once libfile('class/image');
            $image = new image();
            $result = $image->Thumb($newfilename, NULL, 140, 140, 1);
            $thumb = empty($result) ? 0 : 1;
            $image->Watermark($newfilename);
            $pic_remote = 0;
            $album_picflag = 1;
            if (getglobal('setting/ftp/on')) {
                $ftpresult_thumb = 0;
                $ftpresult = ftpupload('album/' . $filepath);
                if ($ftpresult) {
                    if ($thumb) {
                        ftpupload('album/' . $filepath . '.thumb.jpg');
                    }
                    $pic_remote = 1;
                    $album_picflag = 2;
                } else {
                    if (getglobal('setting/ftp/mirror')) {
                        @unlink($newfilename);
                        @unlink($newfilename . '.thumb.jpg');
                        return -3;
                    }
                }
            }
            $filename = addslashes($name ? $name : substr(strrchr($filepath, '/'), 1));
            $title = getstr($title, 200, 1, 1, 1);
            if ($albumid) {
                $albumid = album_creat_by_id($albumid);
            } else {
                $albumid = 0;
            }
            $setarr = array('albumid' => $albumid, 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'filename' => $filename, 'postip' => $_G['clientip'], 'title' => $title, 'type' => $fileext, 'size' => $size, 'filepath' => $filepath, 'thumb' => $thumb, 'remote' => $pic_remote);
            $setarr['picid'] = DB::insert('home_pic', $setarr, 1);
            DB::query("UPDATE " . DB::table('common_member_count') . " SET attachsize=attachsize+{$size} WHERE uid='{$_G['uid']}'");
            include_once libfile('function/stat');
            updatestat('pic');
            return $setarr;
        } else {
            fclose($handle);
        }
    }
    return -3;
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:77,代码来源:function_spacecp.php

示例5: dheader

        dheader('location: ' . $attachurl . $thumbfile);
    }
}
define('NOROBOT', TRUE);
$id = !empty($_GET['atid']) ? $_GET['atid'] : $daid;
if (brand_dsign($id . '|' . $dw . '|' . $dh) != $_GET['key']) {
    ///dheader('location: '.$_G['siteurl'].'static/image/common/none.gif');
}
if ($attach = C::t('#sanree_brand#sanree_brand_businesses')->getbusinesses_by_bid($daid)) {
    if (!$dw && !$dh) {
        dheader('location: ' . $_G['siteurl'] . 'static/image/common/none.gif');
    }
    dheader('Expires: ' . gmdate('D, d M Y H:i:s', TIMESTAMP + 3600) . ' GMT');
    $filename = $_G['setting']['attachdir'] . 'category/' . $attach['poster'];
    require_once libfile('class/image');
    $img = new image();
    if ($img->Thumb($filename, $thumbfile, $w, $h, $type)) {
        if ($nocache) {
            dheader('Content-Type: image');
            @readfile($_G['setting']['attachdir'] . $thumbfile);
            @unlink($_G['setting']['attachdir'] . $thumbfile);
        } else {
            dheader('location: ' . $attachurl . $thumbfile);
        }
    } else {
        dheader('Content-Type: image');
        @readfile($filename);
    }
    exit;
}
dheader('location: ' . $_G['siteurl'] . 'static/image/common/nophoto.gif');
开发者ID:herosrx,项目名称:shops,代码行数:31,代码来源:sanree_brand_image.php

示例6: setthreadcover

function setthreadcover($pid, $tid = 0, $aid = 0)
{
    global $_G;
    $cover = 0;
    if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbwidth']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
        return false;
    }
    if (($pid || $aid) && empty($tid)) {
        if ($aid) {
            $attachtable = getattachtablebyaid($aid);
            $wheresql = "aid='{$aid}' AND isimage IN ('1', '-1')";
        } else {
            $attachtable = getattachtablebypid($pid);
            $wheresql = "pid='{$pid}' AND isimage IN ('1', '-1') ORDER BY width DESC LIMIT 1";
        }
        $query = DB::query("SELECT * FROM " . DB::table($attachtable) . " WHERE {$wheresql}");
        if (!($attach = DB::fetch($query))) {
            return false;
        }
        if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
            return false;
        }
        $pid = empty($pid) ? $attach['pid'] : $pid;
        $tid = empty($tid) ? $attach['tid'] : $tid;
        $basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
        $coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
        dmkdir($basedir . './forum/' . $coverdir);
        $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
        require_once libfile('class/image');
        $image = new image();
        if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
            $remote = '';
            if (getglobal('setting/ftp/on')) {
                if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
                    $remote = '-';
                }
            }
            $cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table($attachtable) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
            $cover = $remote . $cover;
        } else {
            return false;
        }
    }
    if ($tid || $cover) {
        if (empty($cover)) {
            $oldcover = DB::result_first("SELECT cover FROM " . DB::table('forum_thread') . " WHERE tid='{$tid}'");
            $cover = DB::result_first("SELECT COUNT(*) FROM " . DB::table(getattachtablebytid($tid)) . " WHERE pid='{$pid}' AND isimage IN ('1', '-1')");
            $cover = $cover && $oldcover < 0 ? '-' . $cover : $cover;
        }
        DB::update('forum_thread', array('cover' => $cover), array('tid' => $tid));
    }
    return true;
}
开发者ID:v998,项目名称:discuzx-en,代码行数:53,代码来源:function_post.php

示例7: setthreadcover

function setthreadcover($pid, $tid = 0, $aid = 0, $countimg = 0, $imgurl = '')
{
    global $_G;
    $cover = 0;
    if (empty($_G['uid']) || !intval($_G['setting']['forumpicstyle']['thumbheight']) || !intval($_G['setting']['forumpicstyle']['thumbwidth'])) {
        return false;
    }
    if (($pid || $aid) && empty($countimg)) {
        if (empty($imgurl)) {
            if ($aid) {
                $attachtable = 'aid:' . $aid;
                $attach = C::t('forum_attachment_n')->fetch('aid:' . $aid, $aid, array(1, -1));
            } else {
                $attachtable = 'pid:' . $pid;
                $attach = C::t('forum_attachment_n')->fetch_max_image('pid:' . $pid, 'pid', $pid);
            }
            if (!$attach) {
                return false;
            }
            if (empty($_G['forum']['ismoderator']) && $_G['uid'] != $attach['uid']) {
                return false;
            }
            $pid = empty($pid) ? $attach['pid'] : $pid;
            $tid = empty($tid) ? $attach['tid'] : $tid;
            $picsource = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
        } else {
            $attachtable = 'pid:' . $pid;
            $picsource = $imgurl;
        }
        $basedir = !$_G['setting']['attachdir'] ? DISCUZ_ROOT . './data/attachment/' : $_G['setting']['attachdir'];
        $coverdir = 'threadcover/' . substr(md5($tid), 0, 2) . '/' . substr(md5($tid), 2, 2) . '/';
        dmkdir($basedir . './forum/' . $coverdir);
        require_once libfile('class/image');
        $image = new image();
        if ($image->Thumb($picsource, 'forum/' . $coverdir . $tid . '.jpg', $_G['setting']['forumpicstyle']['thumbwidth'], $_G['setting']['forumpicstyle']['thumbheight'], 2)) {
            $remote = '';
            if (getglobal('setting/ftp/on')) {
                if (ftpcmd('upload', 'forum/' . $coverdir . $tid . '.jpg')) {
                    $remote = '-';
                }
            }
            $cover = C::t('forum_attachment_n')->count_image_by_id($attachtable, 'pid', $pid);
            if ($imgurl && empty($cover)) {
                $cover = 1;
            }
            $cover = $remote . $cover;
        } else {
            return false;
        }
    }
    if ($countimg) {
        if (empty($cover)) {
            $thread = C::t('forum_thread')->fetch($tid);
            $oldcover = $thread['cover'];
            $cover = C::t('forum_attachment_n')->count_image_by_id('tid:' . $tid, 'pid', $pid);
            if ($cover) {
                $cover = $oldcover < 0 ? '-' . $cover : $cover;
            }
        }
    }
    if ($cover) {
        C::t('forum_thread')->update($tid, array('cover' => $cover));
        return true;
    }
}
开发者ID:samyex6,项目名称:discuz3.2-lite,代码行数:65,代码来源:function_post.php

示例8: block_template


//.........这里部分代码省略.........
            $blockitem['parity'] = $order % 2;
            $searcharr = $replacearr = array();
            $searcharr[] = '{parity}';
            $replacearr[] = $blockitem['parity'];
            foreach ($fields as $key => $field) {
                $replacevalue = $blockitem[$key];
                $field['datatype'] = !empty($field['datatype']) ? $field['datatype'] : '';
                if ($field['datatype'] == 'int') {
                    // int
                    $replacevalue = intval($replacevalue);
                } elseif ($field['datatype'] == 'string') {
                    $replacevalue = preg_quote($replacevalue);
                } elseif ($field['datatype'] == 'date') {
                    $replacevalue = dgmdate($replacevalue, $block['dateuformat'] ? 'u' : $block['dateformat'], '9999', $block['dateuformat'] ? $block['dateformat'] : '');
                } elseif ($field['datatype'] == 'title') {
                    //title
                    $searcharr[] = '{title-title}';
                    $replacearr[] = preg_quote(!empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : dhtmlspecialchars($replacevalue));
                    $searcharr[] = '{alt-title}';
                    $replacearr[] = preg_quote(!empty($blockitem['fields']['fulltitle']) ? $blockitem['fields']['fulltitle'] : dhtmlspecialchars($replacevalue));
                    $replacevalue = preg_quote($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'title'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'summary') {
                    //summary
                    $replacevalue = preg_quote($replacevalue);
                    if ($blockitem['showstyle'] && ($style = block_showstyle($blockitem['showstyle'], 'summary'))) {
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'pic') {
                    if ($blockitem['picflag'] == '1') {
                        $replacevalue = $_G['setting']['attachurl'] . $replacevalue;
                    } elseif ($blockitem['picflag'] == '2') {
                        $replacevalue = $_G['setting']['ftp']['attachurl'] . $replacevalue;
                    }
                    if ($blockitem['picflag'] && $block['picwidth'] && $block['picheight'] && $block['picwidth'] != 'auto' && $block['picheight'] != 'auto') {
                        if ($blockitem['makethumb'] == 1) {
                            if ($blockitem['picflag'] == '1') {
                                $replacevalue = $_G['setting']['attachurl'] . $blockitem['thumbpath'];
                            } elseif ($blockitem['picflag'] == '2') {
                                $replacevalue = $_G['setting']['ftp']['attachurl'] . $blockitem['thumbpath'];
                            }
                        } elseif (!$_G['block_makethumb'] && !$blockitem['makethumb']) {
                            C::t('common_block_item')->update($itemid, array('makethumb' => 2));
                            require_once libfile('class/image');
                            $image = new image();
                            $thumbpath = block_thumbpath($block, $blockitem);
                            if ($_G['setting']['ftp']['on']) {
                                $ftp =& discuz_ftp::instance();
                                $ftp->connect();
                                if ($ftp->connectid && $ftp->ftp_size($thumbpath) > 0 || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2) && $ftp->upload($_G['setting']['attachurl'] . '/' . $thumbpath, $thumbpath))) {
                                    $picflag = 1;
                                    //common_block_pic表中的picflag标识(0本地,1远程)
                                    $_G['block_makethumb'] = true;
                                    @unlink($_G['setting']['attachdir'] . './' . $thumbpath);
                                }
                            } elseif (file_exists($_G['setting']['attachdir'] . $thumbpath) || ($return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2))) {
                                $picflag = 0;
                                //common_block_pic表中的picflag标识(0本地,1远程)
                                $_G['block_makethumb'] = true;
                            }
                            if ($_G['block_makethumb']) {
                                C::t('common_block_item')->update($itemid, array('makethumb' => 1, 'thumbpath' => $thumbpath));
                                C::t('common_block')->clear_cache($block['bid']);
                                $thumbdata = array('bid' => $block['bid'], 'itemid' => $itemid, 'pic' => $thumbpath, 'picflag' => $picflag, 'type' => '0');
                                C::t('common_block_pic')->insert($thumbdata);
                            }
                        }
                    }
                }
                $searcharr[] = '{' . $key . '}';
                $replacearr[] = $replacevalue;
                if ($block['hidedisplay']) {
                    if (strpos($replacevalue, "\\") !== false) {
                        $replacevalue = str_replace(array('\\.', '\\\\', '\\+', '\\*', '\\?', '\\[', '\\^', '\\]', '\\$', '\\(', '\\)', '\\{', '\\}', '\\=', '\\!', '\\<', '\\>', '\\|', '\\:', '\\-'), array('.', '\\', '+', '*', '?', '[', '^', ']', '$', '(', ')', '{', '}', '=', '!', '<', '>', '|', ':', '-'), $replacevalue);
                    }
                    $_G['block_' . $bid][$order - 1][$key] = $replacevalue;
                }
            }
            foreach ($rtpl as $k => $str_template) {
                if ($str_template) {
                    $str_template = preg_replace('/title=[\'"]{title}[\'"]/', 'title="{title-title}"', $str_template);
                    $str_template = preg_replace('/alt=[\'"]{title}[\'"]/', 'alt="{alt-title}"', $str_template);
                    $rvalue[$k] .= str_replace($searcharr, $replacearr, $str_template);
                    $dynamicparts[$rkey[$k]] = array($rpattern[$k], $rvalue[$k]);
                }
            }
        }
        // foreach($block['itemlist'] as $itemid=>$blockitem) {
        foreach ($dynamicparts as $value) {
            $template = preg_replace($value[0], $value[1], $template);
        }
        $template = str_replace('\\', '&#92;', stripslashes($template));
    }
    $template = preg_replace('/\\s*\\[(order\\d*)=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(index\\d*)=\\w+\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    $template = preg_replace('/\\s*\\[(loop\\d{0,1})\\](.*?)\\[\\/\\1\\]\\s*/is', '', $template);
    return $template;
}
开发者ID:vanloswang,项目名称:discuzx-1,代码行数:101,代码来源:function_block.php

示例9: intval

 function sanree_common_upload($bid)
 {
     global $_G, $config;
     $this->uid = $_G['uid'];
     $where = ' AND uid=' . $_G['uid'];
     $maxpiccount = intval($config['maxpiccount']);
     if ($maxpiccount > 0 && $_G['uid'] != 1) {
         $piccount = C::t('#sanree_brand#sanree_brand_attachment')->count_by_where($where);
         if ($piccount > $maxpiccount) {
             $this->uploadmsg(12);
         }
     }
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     $this->aid = 0;
     $this->simple = 2;
     if ($_GET['hash'] != $swfhash) {
         $this->uploadmsg(10);
     }
     $appVer = $_G['setting']['version'];
     if ($appVer == 'X2') {
         require_once libfile('class/upload');
     }
     $upload = new discuz_upload();
     if (!$config['isbird']) {
         $upload->init($_FILES['Filedata'], 'common');
     } else {
         $file = 'Filedata' . $_G['sr_newbanner'];
         $upload->init($_FILES[$file], 'category');
         $this->newbanner_flag = $_G['sr_newbanner'];
     }
     $this->attach =& $upload->attach;
     if ($upload->error()) {
         $this->uploadmsg(2);
     }
     $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs');
     if (!$allowupload) {
         $this->uploadmsg(6);
     }
     if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
         $this->uploadmsg(1);
     }
     if (empty($upload->attach['size'])) {
         $this->uploadmsg(2);
     }
     if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
         $this->error_sizelimit = $_G['group']['maxattachsize'];
         $this->uploadmsg(3);
     }
     loadcache('attachtype');
     if ($_G['fid'] && isset($_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']];
     } elseif (isset($_G['cache']['attachtype'][0][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][0][$upload->attach['ext']];
     }
     if (isset($maxsize)) {
         if (!$maxsize) {
             $this->error_sizelimit = 'ban';
             $this->uploadmsg(4);
         } elseif ($upload->attach['size'] > $maxsize) {
             $this->error_sizelimit = $maxsize;
             $this->uploadmsg(5);
         }
     }
     if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
         $todaysize = getuserprofile('todayattachsize') + $upload->attach['size'];
         if ($todaysize >= $_G['group']['maxsizeperday']) {
             $this->error_sizelimit = 'perday|' . $_G['group']['maxsizeperday'];
             $this->uploadmsg(11);
         }
     }
     updatemembercount($_G['uid'], array('todayattachs' => 1, 'todayattachsize' => $upload->attach['size']));
     $upload->save();
     if ($upload->error() == -103) {
         $this->uploadmsg(8);
     } elseif ($upload->error()) {
         $this->uploadmsg(9);
     }
     $thumb = $remote = $width = 0;
     if (!$upload->attach['isimage']) {
         $this->uploadmsg(7);
     }
     if ($upload->attach['isimage']) {
         if ($_G['setting']['showexif']) {
             require_once libfile('function/attachment');
             $exif = getattachexif(0, $upload->attach['target']);
         }
         if ($_G['setting']['thumbsource'] || $_G['setting']['thumbstatus']) {
             require_once libfile('class/image');
             $image = new image();
         }
         if ($_G['setting']['thumbsource'] && $_G['setting']['sourcewidth'] && $_G['setting']['sourceheight']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['sourcewidth'], $_G['setting']['sourceheight'], 1, 1) ? 1 : 0;
             $width = $image->imginfo['width'];
             $upload->attach['size'] = $image->imginfo['size'];
         }
         if ($_G['setting']['thumbstatus']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], 0) ? 1 : 0;
             $width = $image->imginfo['width'];
         }
         if ($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
//.........这里部分代码省略.........
开发者ID:herosrx,项目名称:shops,代码行数:101,代码来源:class_sanree_common_upload.php

示例10: intval

 function forum_upload()
 {
     global $_G;
     $this->uid = intval($_G['gp_uid']);
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     if (!$_FILES['Filedata']['error'] && $_G['gp_hash'] == $swfhash) {
         $this->aid = 0;
         $this->simple = !empty($_G['gp_simple']) ? $_G['gp_simple'] : 0;
         $_G['groupid'] = intval(DB::result_first("SELECT groupid FROM " . DB::table('common_member') . " WHERE uid='" . $this->uid . "'"));
         loadcache('usergroup_' . $_G['groupid']);
         $_G['group'] = $_G['cache']['usergroup_' . $_G['groupid']];
         require_once libfile('class/upload');
         $upload = new discuz_upload();
         $upload->init($_FILES['Filedata'], 'forum');
         $this->attach =& $upload->attach;
         if ($upload->error()) {
             $this->uploadmsg(2);
         }
         $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > DB::result_first("SELECT count(*) FROM " . DB::table('forum_attachment') . " WHERE uid='{$_G['uid']}' AND dateline>'{$_G['timestamp']}'-86400");
         if (!$allowupload) {
             $this->uploadmsg(9);
         }
         if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
             $this->uploadmsg(1);
         }
         if (empty($upload->attach['size'])) {
             $this->uploadmsg(2);
         }
         if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
             $this->uploadmsg(3);
         }
         if ($type = DB::fetch_first("SELECT maxsize FROM " . DB::table('forum_attachtype') . " WHERE extension='" . addslashes($upload->attach['ext']) . "'")) {
             if ($type['maxsize'] == 0) {
                 $this->uploadmsg(4);
             } elseif ($upload->attach['size'] > $type['maxsize']) {
                 $this->uploadmsg(5);
             }
         }
         if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
             $todaysize = intval(DB::result_first("SELECT SUM(filesize) FROM " . DB::table('forum_attachment') . " WHERE uid='{$_G['uid']}' AND dateline>'{$_G['timestamp']}'-86400"));
             $todaysize += $upload->attach['size'];
             if ($todaysize >= $_G['group']['maxsizeperday']) {
                 $this->uploadmsg(6);
             }
         }
         $upload->save();
         if ($upload->error() == -103) {
             $this->uploadmsg(8);
         } elseif ($upload->error()) {
             $this->uploadmsg(9);
         }
         $thumb = $remote = $width = 0;
         if ($upload->attach['isimage']) {
             require_once libfile('class/image');
             $image = new image();
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], $_G['setting']['thumbsource']) ? 1 : 0;
             $image->Watermark($upload->attach['target']);
             $width = $image->imginfo['width'];
         }
         if (!$this->simple) {
             $upload->attach['name'] = diconv($upload->attach['name'], 'utf-8');
         }
         if ($_G['gp_type'] != 'image' && $upload->attach['isimage']) {
             $upload->attach['isimage'] = -1;
         }
         DB::query("INSERT INTO " . DB::table('forum_attachment') . " (tid, pid, dateline, readperm, price, filename, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote, width)\n\t\t\t\tVALUES ('0', '0', '{$_G['timestamp']}', '0', '0', '" . $upload->attach['name'] . "', '" . $upload->attach['type'] . "', '" . $upload->attach['size'] . "', '" . $upload->attach['attachment'] . "', '0', '" . $upload->attach['isimage'] . "', '" . $this->uid . "', '{$thumb}', '{$remote}', '{$width}')");
         $this->aid = DB::insert_id();
         $this->uploadmsg(0);
     }
 }
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:70,代码来源:class_forumupload.php

示例11: upload_image

function upload_image($file_name, $type = 'space', $_w = 200, $_h = 200, $cut = 1)
{
    global $_G;
    $attachdir = $_G['setting']['attachdir'];
    $attachurl = $_G['setting']['attachurl'];
    $file = $_FILES[$file_name];
    if ($_FILES[$file_name]['size']) {
        $upload = new discuz_upload();
        if (!$upload->init($file, $type)) {
            return false;
        }
        $upload->save();
        require_once libfile('class/image');
        $image = new image();
        $thumbTarget = $type . '/' . date('Ym') . '/' . date('d') . '/' . $upload->attach['attachment'];
        $image->Thumb($upload->attach['target'], $thumbTarget, $_w, $_h, $cut);
        @unlink($image->source);
        if (!empty($_GET['temp_' . $file_name])) {
            $_goods_pic = addslashes($_GET['temp_' . $file_name]);
            @unlink($_goods_pic);
        }
        return $attachurl . $thumbTarget;
    } elseif (isset($_GET['temp_' . $file_name])) {
        return addslashes($_GET['temp_' . $file_name]);
    }
}
开发者ID:edmundwong,项目名称:V604,代码行数:26,代码来源:function.class.php

示例12: getThumb

 public function getThumb($path, $width, $height, $original)
 {
     global $_G;
     $imgcachePath = './imgcache/';
     $cachepath = str_replace(':', '/', $path);
     $cachepath = preg_replace("/\\/+/", '/', str_replace(':', '/', $path));
     if ($original) {
         $imgurl = self::getStream($path);
         $imginfo = @getimagesize($imgurl);
         header('Content-Type: ' . image_type_to_mime_type($imginfo[2]));
         @readfile($imgurl);
         @flush();
         @ob_flush();
         exit;
     }
     $target = $imgcachePath . $cachepath . '.' . $width . '_' . $height . '.jpeg';
     if (@getimagesize($_G['setting']['attachdir'] . $target)) {
         header('Content-Type: image/JPEG');
         @ob_end_clean();
         if (getglobal('gzipcompress')) {
             @ob_start('ob_gzhandler');
         }
         @readfile($_G['setting']['attachdir'] . $target);
         @flush();
         @ob_flush();
         exit;
     }
     $imgurl = self::getStream($path);
     $imginfo = @getimagesize($imgurl);
     if (is_array($imginfo) && $imginfo[0] < $width && $imginfo[1] < $height) {
         header("Content-Type: " . image_type_to_mime_type($imginfo[2]));
         @ob_end_clean();
         if (getglobal('gzipcompress')) {
             @ob_start('ob_gzhandler');
         }
         @readfile($imgurl);
         @flush();
         @ob_flush();
         exit;
     }
     //生成缩略图
     include_once libfile('class/image');
     $image = new image();
     if ($thumb = $image->Thumb($imgurl, $target, $width, $height, 1)) {
         header('Content-Type: image/JPEG');
         @ob_end_clean();
         if (getglobal('gzipcompress')) {
             @ob_start('ob_gzhandler');
         }
         @readfile($_G['setting']['attachdir'] . $target);
         @flush();
         @ob_flush();
         exit;
     } else {
         header('Content-Type: image/PNG');
         @ob_end_clean();
         if (getglobal('gzipcompress')) {
             @ob_start('ob_gzhandler');
         }
         @readfile($imgurl);
         @flush();
         @ob_flush();
     }
 }
开发者ID:druphliu,项目名称:dzzoffice,代码行数:64,代码来源:io_ftp.php

示例13: intval

 function forum_upload()
 {
     global $_G;
     $_G['uid'] = $this->uid = intval($_GET['uid']);
     $swfhash = md5(substr(md5($_G['config']['security']['authkey']), 8) . $this->uid);
     $this->aid = 0;
     $this->simple = !empty($_GET['simple']) ? $_GET['simple'] : 0;
     if ($_GET['hash'] != $swfhash) {
         $this->uploadmsg(10);
     }
     $upload = new discuz_upload();
     $upload->init($_FILES['Filedata'], 'forum');
     $this->attach =& $upload->attach;
     if ($upload->error()) {
         $this->uploadmsg(2);
     }
     $allowupload = !$_G['group']['maxattachnum'] || $_G['group']['maxattachnum'] && $_G['group']['maxattachnum'] > getuserprofile('todayattachs');
     if (!$allowupload) {
         $this->uploadmsg(6);
     }
     if ($_G['group']['attachextensions'] && (!preg_match("/(^|\\s|,)" . preg_quote($upload->attach['ext'], '/') . "(\$|\\s|,)/i", $_G['group']['attachextensions']) || !$upload->attach['ext'])) {
         $this->uploadmsg(1);
     }
     if (empty($upload->attach['size'])) {
         $this->uploadmsg(2);
     }
     if ($_G['group']['maxattachsize'] && $upload->attach['size'] > $_G['group']['maxattachsize']) {
         $this->error_sizelimit = $_G['group']['maxattachsize'];
         $this->uploadmsg(3);
     }
     loadcache('attachtype');
     if ($_G['fid'] && isset($_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][$_G['fid']][$upload->attach['ext']];
     } elseif (isset($_G['cache']['attachtype'][0][$upload->attach['ext']])) {
         $maxsize = $_G['cache']['attachtype'][0][$upload->attach['ext']];
     }
     if (isset($maxsize)) {
         if (!$maxsize) {
             $this->error_sizelimit = 'ban';
             $this->uploadmsg(4);
         } elseif ($upload->attach['size'] > $maxsize) {
             $this->error_sizelimit = $maxsize;
             $this->uploadmsg(5);
         }
     }
     if ($upload->attach['size'] && $_G['group']['maxsizeperday']) {
         $todaysize = getuserprofile('todayattachsize') + $upload->attach['size'];
         if ($todaysize >= $_G['group']['maxsizeperday']) {
             $this->error_sizelimit = 'perday|' . $_G['group']['maxsizeperday'];
             $this->uploadmsg(11);
         }
     }
     updatemembercount($_G['uid'], array('todayattachs' => 1, 'todayattachsize' => $upload->attach['size']));
     $upload->save();
     if ($upload->error() == -103) {
         $this->uploadmsg(8);
     } elseif ($upload->error()) {
         $this->uploadmsg(9);
     }
     $thumb = $remote = $width = 0;
     if ($_GET['type'] == 'image' && !$upload->attach['isimage']) {
         $this->uploadmsg(7);
     }
     if ($upload->attach['isimage']) {
         if ($_G['setting']['showexif']) {
             require_once libfile('function/attachment');
             $exif = getattachexif(0, $upload->attach['target']);
         }
         if ($_G['setting']['thumbsource'] || $_G['setting']['thumbstatus']) {
             require_once libfile('class/image');
             $image = new image();
         }
         if ($_G['setting']['thumbsource'] && $_G['setting']['sourcewidth'] && $_G['setting']['sourceheight']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['sourcewidth'], $_G['setting']['sourceheight'], 1, 1) ? 1 : 0;
             $width = $image->imginfo['width'];
             $upload->attach['size'] = $image->imginfo['size'];
         }
         if ($_G['setting']['thumbstatus']) {
             $thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], 0) ? 1 : 0;
             $width = $image->imginfo['width'];
         }
         if ($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
             list($width) = @getimagesize($upload->attach['target']);
         }
     }
     if ($_GET['type'] != 'image' && $upload->attach['isimage']) {
         $upload->attach['isimage'] = -1;
     }
     $this->aid = $aid = getattachnewaid($this->uid);
     $insert = array('aid' => $aid, 'dateline' => $_G['timestamp'], 'filename' => censor($upload->attach['name']), 'filesize' => $upload->attach['size'], 'attachment' => $upload->attach['attachment'], 'isimage' => $upload->attach['isimage'], 'uid' => $this->uid, 'thumb' => $thumb, 'remote' => $remote, 'width' => $width);
     C::t('forum_attachment_unused')->insert($insert);
     if ($upload->attach['isimage'] && $_G['setting']['showexif']) {
         C::t('forum_attachment_exif')->insert($aid, $exif);
     }
     $this->uploadmsg(0);
 }
开发者ID:Jaedeok-seol,项目名称:discuz_template,代码行数:96,代码来源:forum_upload.php

示例14: block_template

function block_template($bid)
{
    global $_G;
    $block = empty($_G['block'][$bid]) ? array() : $_G['block'][$bid];
    $theclass = block_getclass($block['blockclass']);
    // for short
    $thestyle = $theclass['style'][$block['styleid']];
    // for short
    if (empty($block) || empty($theclass) || empty($thestyle)) {
        return;
    }
    $template = '';
    if ($block['itemlist']) {
        $template = $thestyle['template']['header'];
        $order = 0;
        foreach ($block['itemlist'] as $blockitem) {
            $order++;
            if (isset($thestyle['template']['order'][$order])) {
                $theteamplte = $thestyle['template']['order'][$order];
            } else {
                $theteamplte = $thestyle['template']['loop'];
            }
            $blockitem['showstyle'] = !empty($blockitem['showstyle']) ? unserialize($blockitem['showstyle']) : array();
            $blockitem['fields'] = !empty($blockitem['fields']) ? $blockitem['fields'] : array();
            $blockitem['fields'] = is_array($blockitem['fields']) ? $blockitem['fields'] : unserialize($blockitem['fields']);
            $blockitem['picwidth'] = !empty($block['picwidth']) ? intval($block['picwidth']) : 'auto';
            $blockitem['picheight'] = !empty($block['picheight']) ? intval($block['picheight']) : 'auto';
            $blockitem['target'] = !empty($block['target']) ? ' target="_' . $block['target'] . '"' : '';
            $fields = array('picwidth' => array(), 'picheight' => array(), 'target' => array());
            $fields = array_merge($fields, $theclass['fields']);
            $searcharr = $replacearr = array();
            foreach ($fields as $key => $field) {
                $replacevalue = isset($blockitem[$key]) ? $blockitem[$key] : (isset($blockitem['fields'][$key]) ? $blockitem['fields'][$key] : '');
                $field['datatype'] = !empty($field['datatype']) ? $field['datatype'] : '';
                if ($field['datatype'] == 'int') {
                    // int
                    $replacevalue = intval($replacevalue);
                } elseif ($field['datatype'] == 'string') {
                    $replacevalue = dhtmlspecialchars($replacevalue);
                } elseif ($field['datatype'] == 'date') {
                    $replacevalue = dgmdate($replacevalue, 'u');
                } elseif ($field['datatype'] == 'title') {
                    //title
                    $replacevalue = stripslashes($replacevalue);
                    $style = block_showstyle($blockitem['showstyle'], 'title');
                    if ($style) {
                        $theteamplte = preg_replace('/title=[\'"]{title}[\'"]/', 'title="{title-title}"', $theteamplte);
                        $theteamplte = preg_replace('/alt=[\'"]{title}[\'"]/', 'alt="{alt-title}"', $theteamplte);
                        $searcharr[] = '{title-title}';
                        $replacearr[] = $replacevalue;
                        $searcharr[] = '{alt-title}';
                        $replacearr[] = $replacevalue;
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'summary') {
                    //summary
                    $replacevalue = stripslashes($replacevalue);
                    $style = block_showstyle($blockitem['showstyle'], 'summary');
                    if ($style) {
                        $replacevalue = htmlspecialchars($replacevalue);
                        $replacevalue = '<font style="' . $style . '">' . $replacevalue . '</font>';
                    }
                } elseif ($field['datatype'] == 'pic') {
                    if ($blockitem['picflag'] == '1') {
                        $replacevalue = $_G['setting']['attachurl'] . $replacevalue;
                    } elseif ($blockitem['picflag'] == '2') {
                        $replacevalue = $_G['setting']['ftp']['attachurl'] . $replacevalue;
                    }
                    if ($block['picwidth'] && $block['picheight'] && $block['picwidth'] != 'auto' && $block['picheight'] != 'auto') {
                        if ($blockitem['makethumb'] == 1) {
                            $replacevalue = $_G['setting']['attachurl'] . block_thumbpath($block, $blockitem);
                        } elseif (!$_G['block_makethumb'] && !$blockitem['makethumb']) {
                            require_once libfile('class/image');
                            $image = new image();
                            $thumbpath = block_thumbpath($block, $blockitem);
                            $return = $image->Thumb($replacevalue, $thumbpath, $block['picwidth'], $block['picheight'], 2);
                            if ($return) {
                                DB::update('common_block_item', array('makethumb' => 1), array('itemid' => $blockitem['itemid']));
                                $replacevalue = $_G['setting']['attachurl'] . $thumbpath;
                            } else {
                                DB::update('common_block_item', array('makethumb' => 2), array('itemid' => $blockitem['itemid']));
                            }
                            $_G['block_makethumb'] = true;
                        }
                    }
                }
                $searcharr[] = '{' . $key . '}';
                $replacearr[] = $replacevalue;
            }
            $template .= str_replace($searcharr, $replacearr, $theteamplte);
        }
        $template .= $thestyle['template']['footer'];
    }
    return $template;
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:95,代码来源:function_block.php

示例15: mobcent_pic_save

/**
 *
 * 在 DISCUZ_ROOT/source/function_spacecp.php 基础上做了改动
 *
 * @author HanPengyu
 * @copyright 2012-2014 Appbyme
 */
function mobcent_pic_save($FILE, $albumid, $title, $iswatermark = true, $catid = 0)
{
    global $_G, $space;
    if ($albumid < 0) {
        $albumid = 0;
    }
    $allowpictype = array('jpg', 'jpeg', 'gif', 'png');
    $upload = new discuz_upload();
    $upload->init($FILE, 'album');
    if ($upload->error()) {
        return lang('spacecp', 'lack_of_access_to_upload_file_size');
    }
    if (!$upload->attach['isimage']) {
        return lang('spacecp', 'only_allows_upload_file_types');
    }
    $oldgid = $_G['groupid'];
    if (empty($space)) {
        $_G['member'] = $space = getuserbyuid($_G['uid']);
        $_G['username'] = $space['username'];
        $_G['groupid'] = $space['groupid'];
    }
    $_G['member'] = $space;
    loadcache('usergroup_' . $space['groupid'], $oldgid != $_G['groupid'] ? true : false);
    $_G['group'] = $_G['cache']['usergroup_' . $space['groupid']];
    if (!checkperm('allowupload')) {
        return lang('spacecp', 'not_allow_upload');
    }
    if (!cknewuser(1)) {
        if ($_G['setting']['newbiespan'] && $_G['timestamp'] - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60) {
            return lang('message', 'no_privilege_newbiespan', array('newbiespan' => $_G['setting']['newbiespan']));
        }
        if ($_G['setting']['need_avatar'] && empty($_G['member']['avatarstatus'])) {
            return lang('message', 'no_privilege_avatar');
        }
        if ($_G['setting']['need_email'] && empty($_G['member']['emailstatus'])) {
            return lang('message', 'no_privilege_email');
        }
        if ($_G['setting']['need_friendnum']) {
            space_merge($_G['member'], 'count');
            if ($_G['member']['friends'] < $_G['setting']['need_friendnum']) {
                return lang('message', 'no_privilege_friendnum', array('friendnum' => $_G['setting']['need_friendnum']));
            }
        }
    }
    if ($_G['group']['maximagesize'] && $upload->attach['size'] > $_G['group']['maximagesize']) {
        return lang('spacecp', 'files_can_not_exceed_size', array('extend' => $upload->attach['ext'], 'size' => sizecount($_G['group']['maximagesize'])));
    }
    $maxspacesize = checkperm('maxspacesize');
    if ($maxspacesize) {
        space_merge($space, 'count');
        space_merge($space, 'field_home');
        if ($space['attachsize'] + $upload->attach['size'] > $maxspacesize + $space['addsize'] * 1024 * 1024) {
            return lang('spacecp', 'inadequate_capacity_space');
        }
    }
    $showtip = true;
    $albumfriend = 0;
    if ($albumid) {
        $catid = intval($catid);
        $albumid = album_creat_by_id($albumid, $catid);
    } else {
        $albumid = 0;
        $showtip = false;
    }
    $upload->save();
    if ($upload->error()) {
        return lang('spacecp', 'mobile_picture_temporary_failure');
    }
    if (!$upload->attach['imageinfo'] || !in_array($upload->attach['imageinfo']['2'], array(1, 2, 3, 6))) {
        @unlink($upload->attach['target']);
        return lang('spacecp', 'only_allows_upload_file_types');
    }
    $new_name = $upload->attach['target'];
    require_once libfile('class/image');
    $image = new image();
    $result = $image->Thumb($new_name, '', 140, 140, 1);
    $thumb = empty($result) ? 0 : 1;
    if ($_G['setting']['maxthumbwidth'] && $_G['setting']['maxthumbheight']) {
        if ($_G['setting']['maxthumbwidth'] < 300) {
            $_G['setting']['maxthumbwidth'] = 300;
        }
        if ($_G['setting']['maxthumbheight'] < 300) {
            $_G['setting']['maxthumbheight'] = 300;
        }
        $image->Thumb($new_name, '', $_G['setting']['maxthumbwidth'], $_G['setting']['maxthumbheight'], 1, 1);
    }
    // 支持客户端上传相册水印 Author:HanPengyu Data:2014/12/04
    Yii::import('application.components.discuz.source.class.class_image', true);
    $image = new Mobcent_Image();
    $image->makeWatermark($new_name, '', 'album');
    // if ($iswatermark) {
    //     $image->Watermark($new_name, '', 'album');
    // }
//.........这里部分代码省略.........
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:101,代码来源:function_spacecp.php


注:本文中的image::Thumb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。