本文整理汇总了PHP中discuz_upload::get_image_info方法的典型用法代码示例。如果您正苦于以下问题:PHP discuz_upload::get_image_info方法的具体用法?PHP discuz_upload::get_image_info怎么用?PHP discuz_upload::get_image_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类discuz_upload
的用法示例。
在下文中一共展示了discuz_upload::get_image_info方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$upload = new discuz_upload();
foreach ($_FILES as $key => $file) {
if (!isset($_G['cache']['profilesetting'][$key])) {
continue;
}
if (!empty($file) && $file['error'] == 0 || !empty($space[$key]) && empty($_G['gp_deletefile'][$key])) {
$value = '1';
} else {
$value = '';
}
if (profile_check($key, $value, $space)) {
$upload->init($file, 'profile');
$attach = $upload->attach;
if (!$upload->error()) {
$upload->save();
if (!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$setarr[$key] = '';
$attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
if ($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) {
if (isset($verifyinfo['field'][$key])) {
@unlink(getglobal('setting/attachdir') . './profile/' . $verifyinfo['field'][$key]);
$verifyarr[$key] = $attach['attachment'];
}
continue;
}
if (isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) {
@unlink(getglobal('setting/attachdir') . './profile/' . $verifyinfo['field'][$key]);
$verifyarr[$key] = $attach['attachment'];
示例2: stream_save
function stream_save($strdata, $albumid = 0, $fileext = 'jpg', $name = '', $title = '', $delsize = 0, $from = false)
{
global $_G, $space;
if ($albumid < 0) {
$albumid = 0;
}
$allowPicType = array('jpg', 'jpeg', 'gif', 'png');
if (!in_array($fileext, $allowPicType)) {
return -3;
}
$setarr = array();
$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 = getuserbyuid($_G['uid']);
$_G['username'] = $space['username'];
}
$_G['member'] = $space;
loadcache('usergroup_' . $space['groupid']);
$_G['group'] = $_G['cache']['usergroup_' . $space['groupid']];
$maxspacesize = checkperm('maxspacesize');
if ($maxspacesize) {
space_merge($space, 'count');
space_merge($space, 'field_home');
if ($space['attachsize'] + $size - $delsize > $maxspacesize + $space['addsize'] * 1024 * 1024) {
@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 = ftpcmd('upload', 'album/' . $filepath);
if ($ftpresult) {
@unlink($_G['setting']['attachdir'] . 'album/' . $filepath);
if ($thumb) {
$thumbpath = getimgthumbname($filepath);
ftpcmd('upload', 'album/' . $thumbpath);
@unlink($_G['setting']['attachdir'] . 'album/' . $thumbpath);
}
$pic_remote = 1;
$album_picflag = 2;
} else {
if (getglobal('setting/ftp/mirror')) {
@unlink($newfilename);
@unlink(getimgthumbname($newfilename));
return -3;
}
}
}
$filename = $name ? $name : substr(strrchr($filepath, '/'), 1);
$title = getstr($title, 200);
$title = censor($title);
if (censormod($title) || $_G['group']['allowuploadmod']) {
$pic_status = 1;
} else {
$pic_status = 0;
}
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, 'status' => $pic_status);
$setarr['picid'] = C::t('home_pic')->insert($setarr, 1);
C::t('common_member_count')->increase($_G['uid'], array('attachsize' => $size));
include_once libfile('function/stat');
updatestat('pic');
return $setarr;
} else {
fclose($handle);
}
}
return -3;
}
示例3: 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;
}
示例4: dreferer
//.........这里部分代码省略.........
} elseif ($uid == -6) {
showmessage('profile_email_duplicate');
} else {
showmessage('undefined_action');
}
}
} else {
list($uid, $username, $email) = $activation;
}
$_G['username'] = $username;
if (getuserbyuid($uid, 1)) {
if (!$activation) {
uc_user_delete($uid);
}
showmessage('profile_uid_duplicate', '', array('uid' => $uid));
}
$password = md5(random(10));
$secques = $questionid > 0 ? random(8) : '';
if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
$profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
}
if (isset($_POST['birthyear'])) {
$profile['zodiac'] = get_zodiac($_POST['birthyear']);
}
if ($_FILES) {
$upload = new discuz_upload();
foreach ($_FILES as $key => $file) {
$field_key = 'field_' . $key;
if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
$upload->init($file, 'profile');
$attach = $upload->attach;
if (!$upload->error()) {
$upload->save();
if (!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
if ($_G['cache']['fields_register'][$field_key]['needverify']) {
$verifyarr[$key] = $attach['attachment'];
} else {
$profile[$key] = $attach['attachment'];
}
}
}
}
}
if ($setregip !== null) {
if ($setregip == 1) {
C::t('common_regip')->update_count_by_ip($_G['clientip']);
} else {
C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp']));
}
}
if ($invite && $this->setting['inviteconfig']['invitegroupid']) {
$groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid'];
}
$init_arr = array('credits' => explode(',', $this->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus);
C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
if ($emailstatus) {
updatecreditbyaction('realemail', $uid);
}
if ($verifyarr) {
$setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => serialize($verifyarr), 'dateline' => TIMESTAMP);
C::t('common_member_verify_info')->insert($setverify);
C::t('common_member_verify')->insert(array('uid' => $uid));
示例5: dreferer
//.........这里部分代码省略.........
showmessage('profile_email_duplicate');
} else {
showmessage('undefined_action');
}
}
} else {
list($uid, $username, $email) = $activation;
}
$_G['username'] = $username;
if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$uid}'")) {
if (!$activation) {
uc_user_delete($uid);
}
showmessage('profile_uid_duplicate', '', array('uid' => $uid));
}
$password = md5(random(10));
$secques = $questionid > 0 ? random(8) : '';
if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) {
$profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
}
if (isset($_POST['birthyear'])) {
$profile['zodiac'] = get_zodiac($_POST['birthyear']);
}
if ($_FILES) {
require_once libfile('class/upload');
$upload = new discuz_upload();
foreach ($_FILES as $key => $file) {
$field_key = 'field_' . $key;
if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') {
$upload->init($file, 'profile');
$attach = $upload->attach;
if (!$upload->error()) {
$upload->save();
if (!$upload->get_image_info($attach['target'])) {
@unlink($attach['target']);
continue;
}
$attach['attachment'] = dhtmlspecialchars(trim($attach['attachment']));
if ($_G['cache']['fields_register'][$field_key]['needverify']) {
$verifyarr[$key] = $attach['attachment'];
} else {
$profile[$key] = $attach['attachment'];
}
}
}
}
}
if ($regipsql) {
DB::query($regipsql);
}
if ($invite && $this->setting['inviteconfig']['invitegroupid']) {
$groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid'];
}
$init_arr = explode(',', $this->setting['initcredits']);
$userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => $groupinfo['groupid'], 'regdate' => TIMESTAMP, 'credits' => $init_arr[0], 'timeoffset' => 9999);
$status_data = array('uid' => $uid, 'regip' => $_G['clientip'], 'lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP, 'lastpost' => 0, 'lastsendmail' => 0);
$profile['uid'] = $uid;
$field_forum['uid'] = $uid;
$field_home['uid'] = $uid;
if ($this->extrafile && file_exists(libfile('member/' . $this->extrafile, 'module'))) {
require_once libfile('member/' . $this->extrafile, 'module');
}
DB::insert('common_member', $userdata);
DB::insert('common_member_status', $status_data);
DB::insert('common_member_profile', $profile);
DB::insert('common_member_field_forum', $field_forum);
示例6: onVideoAuthAuth
function onVideoAuthAuth($uId, $picData, $picExt = 'jpg', $isReward = false)
{
global $_G;
$res = $this->getUserSpace($uId);
if (!$res) {
return new ErrorResponse('1', "User({$uId}) Not Exists");
}
$allowPicType = array('jpg', 'jpeg', 'gif', 'png');
if (in_array($picExt, $allowPicType)) {
$pic = base64_decode($picData);
if (!$pic || strlen($pic) == strlen($picData)) {
$errCode = '200';
$errMessage = 'Error argument';
return new ErrorResponse($errCode, $errMessage);
}
$secret = md5($_G['timestamp'] . "\t" . $_G['uid']);
$picDir = DISCUZ_ROOT . './data/avatar/' . substr($secret, 0, 1);
if (!is_dir($picDir)) {
if (!mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new ErrorResponse($errCode, $errMessage);
}
}
$picDir .= '/' . substr($secret, 1, 1);
if (!is_dir($picDir)) {
if (!@mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new ErrorResponse($errCode, $errMessage);
}
}
$picPath = $picDir . '/' . $secret . '.' . $picExt;
$fp = @fopen($picPath, 'wb');
if ($fp) {
if (fwrite($fp, $pic) !== FALSE) {
fclose($fp);
require_once libfile('class/upload');
$upload = new discuz_upload();
if (!$upload->get_image_info($picPath)) {
@unlink($picPath);
} else {
DB::update('common_member', array('videophotostatus' => 1), array('uid' => $uId));
$count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('common_member_verify') . " WHERE uid='{$uId}'"), 0);
if (!$count) {
DB::insert('common_member_verify', array('uid' => $uId, 'verify7' => 1));
} else {
DB::update('common_member_verify', array('verify7' => 1), array('uid' => $uId));
}
$fields = array('videophoto' => $secret);
DB::update('common_member_field_home', $fields, array('uid' => $uId));
$result = DB::affected_rows();
if ($isReward) {
updatecreditbyaction('videophoto', $uId);
}
return $result;
}
}
fclose($fp);
}
}
$errCode = '300';
$errMessage = 'Video Auth Error';
return new ErrorResponse($errCode, $errMessage);
}
示例7: onVideoAuthAuth
public function onVideoAuthAuth($uId, $picData, $picExt = 'jpg', $isReward = false)
{
global $_G;
$res = $this->getUserSpace($uId);
if (!$res) {
return new Cloud_Service_Server_ErrorResponse('1', "User({$uId}) Not Exists");
}
$allowPicType = array('jpg', 'jpeg', 'gif', 'png');
if (in_array($picExt, $allowPicType)) {
$pic = base64_decode($picData);
if (!$pic || strlen($pic) == strlen($picData)) {
$errCode = '200';
$errMessage = 'Error argument';
return new Cloud_Service_Server_ErrorResponse($errCode, $errMessage);
}
$secret = md5($_G['timestamp'] . "\t" . $_G['uid']);
$picDir = DISCUZ_ROOT . './data/avatar/' . substr($secret, 0, 1);
if (!is_dir($picDir)) {
if (!mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new Cloud_Service_Server_ErrorResponse($errCode, $errMessage);
}
}
$picDir .= '/' . substr($secret, 1, 1);
if (!is_dir($picDir)) {
if (!@mkdir($picDir, 0777)) {
$errCode = '300';
$errMessage = 'Cannot create directory';
return new Cloud_Service_Server_ErrorResponse($errCode, $errMessage);
}
}
$picPath = $picDir . '/' . $secret . '.' . $picExt;
$fp = @fopen($picPath, 'wb');
if ($fp) {
if (fwrite($fp, $pic) !== FALSE) {
fclose($fp);
$upload = new discuz_upload();
if (!$upload->get_image_info($picPath)) {
@unlink($picPath);
} else {
C::t('common_member')->update($uId, array('videophotostatus' => 1));
$memberVerify = C::t('common_member_verify')->fetch($uId);
if (!$memberVerify) {
C::t('common_member_verify')->insert(array('uid' => $uId, 'verify7' => 1));
} else {
C::t('common_member_verify')->update($uId, array('verify7' => 1));
}
$fields = array('videophoto' => $secret);
$result = C::t('common_member_field_home')->update($uId, $fields);
if ($isReward) {
updatecreditbyaction('videophoto', $uId);
}
return $result;
}
}
fclose($fp);
}
}
$errCode = '300';
$errMessage = 'Video Auth Error';
return new Cloud_Service_Server_ErrorResponse($errCode, $errMessage);
}
示例8: forum_downremotefile
//.........这里部分代码省略.........
} else {
$imagereplace['newimageurl'][] = '';
}
continue;
}
if (!$attach['name']) {
$patharr = explode('/', $imageurl);
$attach['name'] = trim($patharr[count($patharr) - 1]);
}
$patharr = explode('/', $imageurl);
if (!$attach['name']) {
$attach['name'] = trim($patharr[count($patharr) - 1]);
}
$attach['thumb'] = '';
$attach['ext'] = trim($attach['ext']);
//不加这个有些还真不行
$attach['isimage'] = $upload->is_image_ext($attach['ext']);
if ($attach['isimage'] == 1 && $arr['is_download_img'] != 1) {
$imagereplace['newimageurl'][] = $value[0];
continue;
}
$attach['extension'] = $upload->get_target_extension($attach['ext']);
$attach['attachdir'] = $upload->get_target_dir('forum');
$attach['attachment'] = $attach['attachdir'] . $upload->get_target_filename('forum') . '.' . $attach['extension'];
$attach['target'] = getglobal('setting/attachdir') . './forum/' . $attach['attachment'];
if (!in_array($attach['ext'], $get_file_ext_arr) && $get_file_ext_arr && $attach['isimage'] == 0) {
if ($value[4] == 1) {
if ($del_a == 1) {
$imagereplace['newimageurl'][] = $value[2];
} else {
unset($imagereplace['oldimageurl'][$key]);
}
} else {
$imagereplace['newimageurl'][] = '';
}
continue;
}
if (!@($fp = fopen($attach['target'], 'wb'))) {
continue;
} else {
flock($fp, 2);
fwrite($fp, $content);
fclose($fp);
}
if (!$upload->get_image_info($attach['target']) && $attach['isimage'] == 1) {
@unlink($attach['target']);
continue;
}
$attach['size'] = filesize($attach['target']);
$upload->attach = $attach;
$thumb = $width = 0;
if ($upload->attach['isimage']) {
if ($_G['setting']['thumbstatus']) {
$image = new image();
$thumb = $image->Thumb($upload->attach['target'], '', $_G['setting']['thumbwidth'], $_G['setting']['thumbheight'], $_G['setting']['thumbstatus'], $_G['setting']['thumbsource']) ? 1 : 0;
$width = $image->imginfo['width'];
}
if ($_G['setting']['thumbsource'] || !$_G['setting']['thumbstatus']) {
list($width) = @getimagesize($upload->attach['target']);
}
if ($_G['setting']['watermarkstatus'] && empty($_G['forum']['disablewatermark']) && $arr['is_water_img'] == 1) {
$image = new image();
$image->Watermark($attach['target'], '', 'forum');
}
}
$desc = $value[3];
$arr['public_time'] = $arr['public_time'] ? $arr['public_time'] : $arr['dateline'];
$arr['public_time'] = $arr['public_time'] ? $arr['public_time'] : $_G['timestamp'];
$remote = 0;
$setarr = array('uid' => $arr['uid'], 'tid' => $arr['tid'], 'pid' => $arr['pid'], 'filename' => daddslashes($upload->attach['name']), 'attachment' => $upload->attach['attachment'], 'filesize' => $upload->attach['size'], 'thumb' => $thumb, 'remote' => $remote, 'picid' => $picid, 'isimage' => $attach['isimage'], 'description' => $desc, 'readperm' => 0, 'price' => 0, 'width' => $width, 'dateline' => $arr['public_time']);
$setimg_arr = array('tid' => $arr['tid'], 'attachment' => $upload->attach['attachment'], 'remote' => $remote);
$set_att = array('downloads' => rand(1, 15), 'tableid' => getattachtableid($arr['tid']), 'uid' => $arr['uid'], 'pid' => $arr['pid'], 'tid' => $arr['tid']);
if ($threadimage_flag == 0 && !$arr['is_post'] && $attach['isimage'] == 1) {
DB::insert('forum_threadimage', $setimg_arr, true);
$threadimage_flag = 1;
}
$setarr['aid'] = $newaids[] = DB::insert('forum_attachment', $set_att, true);
$at[] = $setarr['aid'];
$attachnew_arr[$setarr['aid']] = array('description' => $setarr['description']);
DB::insert(getattachtablebytid($arr['tid']), $setarr, true);
$attachaids[$hash] = $imagereplace['newimageurl'][] = '[attach]' . $setarr['aid'] . '[/attach]';
} else {
$imagereplace['newimageurl'][] = $attachaids[$hash];
}
}
}
if ($_G['setting']['ftp']['on'] == 1) {
require_once libfile('function/post');
ftpupload($newaids, $arr['uid']);
}
if (count($at) > 0) {
$arr['attachment'] = 2;
}
$arr['message'] = str_replace($imagereplace['oldimageurl'], $imagereplace['newimageurl'], $arr['message']);
if ($del_a == 1) {
$arr['message'] = clear_html_script($arr['message'], array(0));
}
forum_article_content($arr);
}
}