野生大熊猫

Discuz图片上传函数
Discuz上传函数调用文件中对象 sourceclassdiscuzdiscuz_upload.php第一种: ...
扫描右侧二维码阅读全文
16
2018/05

Discuz图片上传函数

Discuz上传函数

调用文件中对象 sourceclassdiscuzdiscuz_upload.php

第一种: sourcefunctionfunction_home.php

function pic_upload($FILES, $type='album', $thumb_width=0, $thumb_height=0, $thumb_type=2) {
    ...
    ...
    ...
    return $result;
}

测试上传返回值为

array (size=3)
  'pic' => string '201709/06/173409iffc1mefuscccxur.png' (length=36)
  'thumb' => int 0
  'remote' => int 0

第二种: sourcefunctionfunction_spacecp.php

function pic_save($FILE, $albumid, $title, $iswatermark = true, $catid = 0) {
    ...
}

测试上传返回值

array (size=15)
  'albumid' => int 0
  'uid' => string '1' (length=1)
  'username' => string 'admin' (length=5)
  'dateline' => int 1504691483
  'filename' => string 'wx.jpg' (length=6)
  'postip' => string '127.0.0.1' (length=9)
  'port' => string '3250' (length=4)
  'title' => string '这是从test.php文件上传的文件!' (length=39)
  'type' => string 'jpg' (length=3)
  'size' => int 31140
  'filepath' => string '201709/06/175123vh29ill29lq2wq9l.jpg' (length=36)
  'thumb' => int 1
  'remote' => int 0
  'status' => int 0
  'picid' => int 3

图片删除函数

function pic_delete($pic, $type, $thumb, $remote) {
    global $_G;

    if($remote > 1 && $type == 'album') {
        $remote -= 2;
        $type = 'forum';
        return true;
    }

    if($remote) {
        ftpcmd('delete', $type.'/'.$pic);
        if($thumb) {
            ftpcmd('delete', $type.'/'.getimgthumbname($pic));
        }
        ftpcmd('close');
    } else {
        @unlink($_G['setting']['attachdir'].'/'.$type.'/'.$pic);
        if($thumb) {
            @unlink($_G['setting']['attachdir'].'/'.$type.'/'.getimgthumbname($pic));
        }
    }
    return true;
}
Last modification:May 17th, 2018 at 01:06 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment