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


PHP zmf::uploadDirs方法代码示例

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


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

示例1: getAvatar

 public static function getAvatar($aid, $size = 170)
 {
     $info = Attachments::getOne($aid);
     $url = '';
     if ($info) {
         $url = zmf::uploadDirs($info['cTime'], 'site', $info['classify'], $size) . $info['filePath'];
     }
     return $url;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:9,代码来源:WeddingGroup.php

示例2: actionIndex

 public function actionIndex()
 {
     $areas = Area::getTops();
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->pageTitle = zmf::config('sitename');
     $data = array('areas' => $areas, 'flashs' => $flashArr, 'posts' => $posts);
     $this->render('/index/index', $data);
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:14,代码来源:IndexController.php

示例3: faceImg

 /**
  * 返回坐标的封面图
  * @param type $poiInfo
  * @param type $size
  * @return string
  */
 public static function faceImg($poiInfo, $size = '170', $type = 'posts')
 {
     $url = '';
     if ($poiInfo['faceimg']) {
         $info = Attachments::getOne($poiInfo['faceimg']);
         if ($info) {
             if ($info['remote'] != '') {
                 $url = $info['remote'];
             } else {
                 $url = zmf::uploadDirs($info['cTime'], 'site', $info['classify']) . $info['filePath'];
             }
         }
     }
     if (!$url) {
         return '';
     }
     $reurl = zmf::getThumbnailUrl($url, $size, $type);
     return $reurl;
 }
开发者ID:ph7pal,项目名称:momo,代码行数:25,代码来源:Attachments.php

示例4: array

<?php

$_imgurl = zmf::uploadDirs($data['cTime'], 'site', $data['classify'], 170) . $data['filePath'];
$_originImgurl = zmf::uploadDirs($data['cTime'], 'site', $data['classify'], 600) . $data['filePath'];
$_href = Yii::app()->createUrl('position/image', array('id' => $data['id']));
?>
<a href="<?php 
echo $_originImgurl;
?>
" target="_blank"><img data-original="<?php 
echo $_imgurl;
?>
" class="lazy poi-image-list" alt="<?php 
echo $alt;
?>
" src="<?php 
echo zmf::lazyImg();
?>
" width="155" height="116"/></a>
开发者ID:ph7pal,项目名称:wedding,代码行数:19,代码来源:_image.php

示例5: array

    $_address = $info['address_en'];
    $_addLocal = true;
} else {
    $_address = $info['address_local'];
}
$this->renderPartial('/position/bread', array('breads' => $breads));
if (!empty($images)) {
    ?>
<div class="poi-ppt-left" style="background: url(<?php 
    echo $info['faceimg'];
    ?>
) no-repeat center"></div>
<div class="poi-ppt-right">
    <?php 
    foreach ($images as $image) {
        $_imgurl = zmf::uploadDirs($image['cTime'], 'site', $image['classify'], 170) . $image['filePath'];
        ?>
    <div class="poi-ppt-img" style="background: url(<?php 
        echo $_imgurl;
        ?>
) no-repeat center"></div>
    <?php 
    }
    ?>
</div>
<?php 
}
?>
<div class="clearfix"></div>
<div role="tabpanel">
    <!-- Nav tabs -->
开发者ID:ph7pal,项目名称:wedding,代码行数:31,代码来源:view.php

示例6: faceImg

 /**
  * 返回坐标的封面图
  * @param type $poiInfo
  * @param type $size
  * @return string
  */
 public static function faceImg($poiInfo, $size = '170')
 {
     $url = '';
     if ($poiInfo['faceimg']) {
         $info = Attachments::getOne($poiInfo['faceimg']);
         if ($info) {
             $url = zmf::uploadDirs($info['cTime'], 'site', $info['classify'], $size) . $info['filePath'];
         }
     }
     return $url;
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:17,代码来源:Attachments.php

示例7: foreach

        }
        ?>
                           
                <?php 
    }
    ?>
            </ul>
        </div>
        <div class="bd">
                <ul>
               <?php 
    if (!empty($topads)) {
        ?>
                  <?php 
        foreach ($topads as $key => $val) {
            $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
            ?>
                            
                    <li><a href="javascript:;" target="_blank"><img src="<?php 
            echo $_imgurl;
            ?>
"></a></li>
                  <?php 
        }
        ?>
                           
              <?php 
    }
    ?>
                </ul>
        </div>
开发者ID:ph7pal,项目名称:wedding,代码行数:31,代码来源:ads.php

示例8: array

<?php

$topads = Ads::getAllByPo('sidebtn', 'img', '', 1);
if ($topads) {
    $_imgurl = zmf::uploadDirs($topads[0]['cTime'], 'site', $topads[0]['classify'], 'origin') . $topads[0]['filePath'];
    echo "<div class='col-xs-12 col-sm-12' style='margin-bottom:15px;'><img src='{$_imgurl}' class='img-responsive'/></div>";
}
?>
<div class="clearfix"></div>
<?php 
if ($type == 'travel') {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('创建行程', array('travel/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<?php 
} else {
    ?>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('写游记', array('posts/create'), array('class' => 'btn btn-success btn-block'));
    ?>
</div>
<div class="col-xs-6 col-sm-6">
    <?php 
    echo CHtml::link('我要提问', array('question/create'), array('class' => 'btn btn-default btn-block'));
    ?>
</div>
<?php 
开发者ID:ph7pal,项目名称:wedding,代码行数:31,代码来源:side_toolbar.php

示例9: actionUpload

 public function actionUpload()
 {
     $uptype = zmf::filterInput($_GET['type'], 't', 1);
     $logid = zmf::filterInput($_GET['id']);
     //所属对象
     $reImgsize = zmf::filterInput($_GET['imgsize']);
     //返回图片的尺寸
     $fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
     //上传控件的ID
     //将ads替换为flash
     if (!isset($uptype) or !in_array($uptype, array('siteinfo', 'post'))) {
         $this->jsonOutPut(0, '请设置上传所属类型' . $uptype);
     }
     if (Yii::app()->request->getParam('PHPSESSID')) {
         Yii::app()->session->close();
         $res = Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
         Yii::app()->session->open();
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
     }
     if (!$fileholder) {
         $fileholder = 'filedata';
     }
     if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
         $this->jsonOutPut(0, '无效上传,请重试');
     }
     $model = new Attachments();
     $img = CUploadedFile::getInstanceByName($fileholder);
     $ext = $img->getExtensionName();
     $size = $img->getSize();
     if ($size > zmf::config('imgMaxSize')) {
         $this->jsonOutPut(0, '上传文件最大尺寸为:' . tools::formatBytes(zmf::config('imgMaxSize')));
     }
     $upExt = zmf::config("imgAllowTypes");
     if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
         $this->jsonOutPut(0, '上传文件扩展名必需为:' . $upExt);
     }
     $sizeinfo = getimagesize($_FILES[$fileholder]["tmp_name"]);
     if ($sizeinfo['0'] < zmf::config('imgMinWidth') or $sizeinfo[1] < zmf::config('imgMinHeight')) {
         $this->jsonOutPut(0, "要求上传的图片尺寸,宽不能不小于" . zmf::config('imgMinWidth') . "px,高不能小于" . zmf::config('imgMinHeight') . "px.");
     }
     $ctime = zmf::now();
     $dirs = zmf::uploadDirs($ctime, 'app', $uptype, null, true);
     $fileName = uniqid() . '.' . $ext;
     $origin = $dirs['origin'];
     unset($dirs['origin']);
     $uploadedFiles = array();
     $uploadedFiles[] = array('from' => $origin . $fileName, 'to' => zmf::ftpPath($ctime, $uptype, 'origin') . $fileName);
     if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $origin . $fileName)) {
         $data = array();
         $status = Posts::STATUS_PASSED;
         $data['uid'] = Yii::app()->user->id;
         $data['logid'] = $logid;
         $data['filePath'] = $fileName;
         $data['fileDesc'] = $fileName;
         $data['classify'] = $uptype;
         $data['covered'] = '0';
         $data['cTime'] = time();
         $data['status'] = $status;
         $data['width'] = $sizeinfo[0];
         $data['height'] = $sizeinfo[1];
         $data['size'] = $size;
         $model->attributes = $data;
         if ($model->validate()) {
             if ($model->save()) {
                 $image = Yii::app()->image->load($origin . $fileName);
                 $_quality = zmf::config('imgQuality');
                 $quality = isset($quality) ? $quality : 100;
                 foreach ($dirs as $dk => $_dir) {
                     if ($dk < 600) {
                         $image->smart_resize($dk, $dk * 0.75)->quality($quality);
                     } else {
                         $image->resize($dk, $dk)->quality($quality);
                     }
                     $image->save($_dir . $fileName);
                     $_todir = zmf::ftpPath($ctime, $uptype, $dk);
                     $uploadedFiles[] = array('id' => $model->id, 'from' => $_dir . $fileName, 'to' => $_todir . $fileName);
                 }
                 $imgsize = $reImgsize > 0 ? $reImgsize : 170;
                 $returnimg = zmf::uploadDirs($ctime, 'site', $uptype, $imgsize) . $fileName;
                 $outPutData = array('status' => 1, 'attachid' => $model->id, 'imgsrc' => $returnimg);
                 $json = CJSON::encode($outPutData);
                 echo $json;
             } else {
                 $this->jsonOutPut(0, '写入数据库错误');
             }
         } else {
             $this->jsonOutPut(0, '数据验证错误');
         }
     }
 }
开发者ID:ph7pal,项目名称:mei,代码行数:92,代码来源:Attachments2Controller.php

示例10: actionUpload

 public function actionUpload()
 {
     $uptype = zmf::filterInput($_GET['type'], 't', 1);
     $logid = zmf::filterInput($_GET['id']);
     //所属对象
     $reImgsize = zmf::filterInput($_GET['imgsize']);
     //返回图片的尺寸
     $fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
     //上传控件的ID
     if (!isset($uptype) or !in_array($uptype, array('posts', 'siteinfo'))) {
         $this->jsonOutPut(0, '请设置上传所属类型' . $uptype);
     }
     if (Yii::app()->request->getParam('PHPSESSID')) {
         Yii::app()->session->close();
         $res = Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
         Yii::app()->session->open();
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, '请先登录');
     }
     if (!$fileholder) {
         $fileholder = 'filedata';
     }
     if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
         $this->jsonOutPut(0, '无效上传,请重试');
     }
     $img = CUploadedFile::getInstanceByName($fileholder);
     $ext = $img->getExtensionName();
     $size = $img->getSize();
     if ($size > zmf::config('imgMaxSize')) {
         $this->jsonOutPut(0, '上传文件最大尺寸为:' . tools::formatBytes(zmf::config('imgMaxSize')));
     }
     $upExt = zmf::config("imgAllowTypes");
     if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
         $this->jsonOutPut(0, '上传文件扩展名必需为:' . $upExt);
     }
     $sizeinfo = getimagesize($_FILES[$fileholder]["tmp_name"]);
     if ($sizeinfo['0'] < zmf::config('imgMinWidth') or $sizeinfo[1] < zmf::config('imgMinHeight')) {
         $this->jsonOutPut(0, "要求上传的图片尺寸,宽不能不小于" . zmf::config('imgMinWidth') . "px,高不能小于" . zmf::config('imgMinHeight') . "px.");
     }
     $ctime = zmf::now();
     $dir = zmf::uploadDirs($ctime, 'app', $uptype);
     zmf::createUploadDir($dir);
     $fileName = zmf::uuid() . '.' . $ext;
     $origin = $dir;
     if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $origin . $fileName)) {
         $data = array();
         $status = Posts::STATUS_NOTPASSED;
         $data['uid'] = zmf::uid();
         $data['logid'] = $logid;
         $data['filePath'] = $fileName;
         $data['fileDesc'] = '';
         $data['classify'] = $uptype;
         $data['covered'] = '0';
         $data['cTime'] = $ctime;
         $data['status'] = $status;
         $data['width'] = $sizeinfo[0];
         $data['height'] = $sizeinfo[1];
         $data['size'] = $size;
         $model = new Attachments();
         $model->attributes = $data;
         if ($model->save()) {
             $attachid = $model->id;
             $returnImgDir = zmf::getUpExtraUrl($ctime);
             $saveName = $uptype . '/' . $returnImgDir . '/' . $fileName;
             $accessKey = zmf::config('qiniuAk');
             $secretKey = zmf::config('qiniuSk');
             $bucket = zmf::config('qiniuBucket');
             if ($accessKey && $secretKey && $bucket) {
                 $auth = new Auth($accessKey, $secretKey);
                 $token = $auth->uploadToken($bucket);
                 $uploadMgr = new UploadManager();
                 list($ret, $err) = $uploadMgr->putFile($token, $saveName, $origin . $fileName);
                 if ($err !== null) {
                     zmf::fp(var_export($err));
                     $this->jsonOutPut(0, '上传至云服务错误');
                 }
             }
             $returnimg = zmf::uploadDirs($ctime, 'site', $uptype) . $fileName;
             $returnimg = zmf::getThumbnailUrl($returnimg, '650', $uptype);
             $_attr = array('id' => $attachid, 'imgurl' => $returnimg);
             $html = '';
             if ($uptype == 'posts') {
                 //$html=  $this->renderPartial('/posts/_addImg',array('data'=>$_attr),true);
             }
             $outPutData = array('status' => 1, 'attachid' => $attachid, 'imgsrc' => $returnimg, 'html' => $html);
             $json = CJSON::encode($outPutData);
             echo $json;
         } else {
             $this->jsonOutPut(0, '写入数据库错误');
         }
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:93,代码来源:AttachmentsController.php

示例11: actionDelUploadImg

 public function actionDelUploadImg($_attachid = '')
 {
     if (!empty($_attachid)) {
         $attachid = $_attachid;
     } else {
         $attachid = zmf::filterInput($_POST['attachid'], 't', 1);
     }
     //$attachid=tools::jieMi($attachid);
     if (!Yii::app()->request->isAjaxRequest) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
     }
     $info = Attachments::getOne($attachid);
     if (!$info) {
         $this->jsonOutPut(0, Yii::t('default', 'pagenotexists'));
     }
     if ($info['uid'] != Yii::app()->user->id and !$admin) {
         $this->jsonOutPut(0, Yii::t('default', 'forbiddenaction'));
     }
     if ($info['classify'] == 'coverimg') {
         $model = new Posts();
     } elseif ($info['classify'] == 'columns') {
         $model = new Columns();
     } elseif ($info['classify'] == 'ads') {
         $model = new Ads();
     }
     $dirs = zmf::uploadDirs($info['logid'], 'app', $info['classify']);
     if (empty($dirs)) {
         $this->jsonOutPut(0, Yii::t('default', 'unkownerror'));
     }
     foreach ($dirs as $dir) {
         $filePath = $dir . '/' . $info['filePath'];
         //$this->delItem($attchid, $filePath);
         @unlink($filePath);
     }
     if (Attachments::model()->deleteByPk($attachid)) {
         zmf::delFCache("attach{$attachid}");
         if (isset($model)) {
             $model->updateAll(array('attachid' => 0), 'id=:id', array(':id' => $info['logid']));
         }
         if ($admin) {
             $this->jsonOutPut(1, '操作成功!');
         } else {
             $this->jsonOutPut(1, '操作成功!');
         }
     } else {
         $this->jsonOutPut(0, '操作失败');
     }
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:51,代码来源:AttachmentsController.php

示例12: actionLogin


//.........这里部分代码省略.........
                 }
                 if ($user) {
                     $bindInfo = UserWeixin::model()->findByPk($user['id']);
                     if ($bindInfo) {
                         $hasBind = true;
                     }
                     $binddata['uid'] = $user['id'];
                 }
             }
             if ($hasBind) {
                 $model->addError('email', '该账号已绑定其他账号');
             } elseif ($model->login()) {
                 $arr = array('last_login_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_time' => time());
                 Users::model()->updateByPk(Yii::app()->user->id, $arr);
                 Users::model()->updateCounters(array('login_count' => 1), ':id=id', array(':id' => Yii::app()->user->id));
                 if ($this->referer == '') {
                     $this->referer = array('users/index', 'id' => Yii::app()->user->id);
                 }
                 zmf::delCookie('checkWithCaptcha');
                 //微博绑定已有账号
                 if ($bind == 'weibo') {
                     UserSina::addCookie($binddata);
                 } elseif ($bind == 'qq') {
                     UserQq::addCookie($binddata);
                 } elseif ($bind == 'weixin') {
                     UserWeixin::addCookie($binddata);
                 }
                 $this->redirect($this->referer);
             }
         } else {
             zmf::setCookie('checkWithCaptcha', 1, 86400);
         }
     } elseif (isset($_POST['Users'])) {
         $from = 'reg';
         //注册
         if (UserAction::checkRegTimes()) {
             $this->message(0, '您今天的注册次数已用完');
         }
         $email = zmf::filterInput($_POST['Users']['email'], 't', 1);
         $truename = zmf::filterInput($_POST['Users']['truename'], 't', 1);
         $inputData = array('truename' => $truename, 'password' => $_POST['Users']['password'] != '' ? md5($_POST['Users']['password']) : '', 'email' => $email, 'cTime' => time(), 'register_time' => time(), 'last_login_time' => time(), 'groupid' => zmf::config('userDefaultGroup'), 'register_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_ip' => ip2long(Yii::app()->request->userHostAddress));
         $modelUser->attributes = $inputData;
         if ($modelUser->validate()) {
             if ($modelUser->save()) {
                 $_model = new LoginForm();
                 $_model->email = $email;
                 $_model->password = $_POST['Users']['password'];
                 $_model->login();
                 if ($bind == 'weibo') {
                     $strdata = zmf::getCookie('userWeiboData');
                     //取出cookie中用户的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserSina::addCookie($binddata);
                     }
                 } elseif ($bind == 'qq') {
                     $strdata = zmf::getCookie('userQQData');
                     //取出cookie中用户的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserQq::addCookie($binddata);
                     }
                 } elseif ($bind == 'weixin') {
                     $strdata = zmf::getCookie('userWeixinData');
                     //取出cookie中用户的微信信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserWeixin::addCookie($binddata);
                     }
                 }
                 //登录成功后跳转到修改个人资料页面
                 $this->redirect(array('users/update', 'type' => 'info'));
             }
         }
     }
     if ($bind) {
         $this->loginTitle = '绑定已有账户';
         $this->regTitle = '完善资料';
     } else {
         $this->loginTitle = '登录';
         $this->regTitle = '注册';
     }
     if ($from == 'login') {
         $this->pageTitle = $this->loginTitle . ' - ' . zmf::config('sitename');
     } else {
         $this->pageTitle = $this->regTitle . ' - ' . zmf::config('sitename');
     }
     //登录页面的幻灯片
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->render('login', array('model' => $model, 'modelUser' => $modelUser, 'from' => $from, 'flashs' => $flashArr));
 }
开发者ID:ph7pal,项目名称:wedding,代码行数:101,代码来源:SiteController.php

示例13: actionSimpleUpload

 /**
  * 不入数据库的上传
  * 不做压缩和缩略图处理
  */
 public function actionSimpleUpload()
 {
     $uptype = zmf::filterInput($_GET['type'], 't', 1);
     $fileholder = zmf::filterInput($_GET['fileholder'], 't', 1);
     //上传控件的ID
     $fileName = zmf::filterInput($_GET['fileName'], 't', 1);
     //上传后保存名字
     $keyid = zmf::filterInput($_GET['keyid']);
     //所属对象ID
     if (!isset($uptype) or !in_array($uptype, array('avatar'))) {
         $this->jsonOutPut(0, '请设置上传所属类型' . $uptype);
     }
     if (Yii::app()->request->getParam('PHPSESSID')) {
         Yii::app()->session->close();
         Yii::app()->session->setSessionID(Yii::app()->request->getParam('PHPSESSID'));
         Yii::app()->session->open();
     }
     if (Yii::app()->user->isGuest) {
         $this->jsonOutPut(0, Yii::t('default', 'loginfirst'));
     }
     //        $checkInfo = UserPower::check('addImage', true);
     //        if (!$checkInfo['status']) {
     //            $this->jsonOutPut(0, $checkInfo['msg']);
     //        }
     if (!$fileholder) {
         $fileholder = 'filedata';
     }
     if (!isset($_FILES[$fileholder]) || !is_uploaded_file($_FILES[$fileholder]["tmp_name"]) || $_FILES[$fileholder]["error"] != 0) {
         $this->jsonOutPut(0, '无效上传,请重试');
     }
     $img = CUploadedFile::getInstanceByName($fileholder);
     $ext = $img->getExtensionName();
     $size = $img->getSize();
     if ($size > zmf::config('imgMaxSize')) {
         $this->jsonOutPut(0, '上传文件最大尺寸为:' . tools::formatBytes(zmf::config('imgMaxSize')));
     }
     $upExt = zmf::config("imgAllowTypes");
     if (!preg_match('/^(' . str_replace('*.', '|', str_replace(';', '', $upExt)) . ')$/i', $ext)) {
         $this->jsonOutPut(0, '上传文件扩展名必需为:' . $upExt);
     }
     if (!$fileName) {
         $fileName = uniqid() . '.' . $ext;
     }
     if ($uptype == 'avatar') {
         $fileName = $keyid . '.jpg';
     }
     $ctime = zmf::now();
     $dirs = zmf::uploadDirs($ctime, 'app', $uptype, null, true);
     $fileName = uniqid() . '.' . $ext;
     $origin = $dirs['origin'];
     unset($dirs['origin']);
     $fileNameWithoutDomain = zmf::getUpExtraUrl($ctime) . '/600_' . $fileName;
     //相对于网站的存放路径
     if (move_uploaded_file($_FILES[$fileholder]["tmp_name"], $origin . $fileName)) {
         Yii::import('application.vendors.thinkphp.*');
         require_once 'ImageGd.php';
         foreach ($dirs as $dk => $_dir) {
             $image = new ImageGd($origin . $fileName);
             $image->thumb($dk, $dk, 'center');
             $image->save($_dir . $fileName);
         }
         Users::model()->updateByPk($this->uid, array('avatar' => $fileNameWithoutDomain));
         $imgsize = $reImgsize > 0 ? $reImgsize : 170;
         $returnimg = zmf::uploadDirs($ctime, 'site', $uptype, $imgsize) . $fileName;
         $outPutData = array('status' => 1, 'imgsrc' => $returnimg, 'attachid' => '');
         $json = CJSON::encode($outPutData);
         echo $json;
     } else {
         $this->jsonOutPut(0, '上传失败');
     }
 }
开发者ID:ph7pal,项目名称:naodong,代码行数:75,代码来源:AttachmentsController.php


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