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


PHP photo::copyImageWithSize方法代码示例

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


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

示例1: create

 /**
  * 注册内部管理账户
  *
  * @access public
  * @param string phoneNum 手机号
  * @param string password 登陆密码md5
  * @return array
  */
 public function create()
 {
     #参数检查
     $this->params = $this->require_params(array('phoneNum', 'password'));
     $this->params['nickname'] = F::request('nickname', '');
     $this->params['project'] = F::request('project', '');
     $this->params['project'] = str_replace(',', ',', $this->params['project']);
     if (!FValidator::phone($this->params['phoneNum'])) {
         throw new Exception('手机号格式非法', 100);
     }
     #检查手机是否已经注册
     $userId = $this->userModel->getUserIdByUsername($this->params['phoneNum']);
     if (!$userId) {
         #生成一个新的账户
         $userId = $this->userModel->create($this->params['phoneNum'], $this->params['password'], self::ADMIN_ACCOUNT);
     } else {
         #更新账户密码信息
         $updateResult = $this->userModel->updatePassword($userId, $this->params['password']);
     }
     #保存图片信息
     $filePath = 'avatar/' . $userId . '_' . md5_file($_FILES['photo']['tmp_name']) . '.' . end(explode('.', $_FILES['photo']['name']));
     $this->photoTool->copyImageWithSize($_FILES['photo']['tmp_name'], self::IMG_PATH_BASE . $filePath, 60, 60);
     $this->params['photo'] = $filePath;
     #更新用户昵称
     $this->userModel->updateUserProfile($userId, $this->params['nickname'], $filePath);
     #授权相关项目授权
     $this->userModel->getProjectAuth($userId, explode(',', $this->params['project']));
     #跳转回user_add页面
     header('location:http://' . $_SERVER['HTTP_HOST'] . '/' . self::CRM_ADMIN_BASE . 'user_add.php');
 }
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:38,代码来源:user_controller.php

示例2: end

<?php 
if ($_POST) {
    #更新or创建账户信息
    $param['phoneNum'] = $_POST['phoneNum'];
    $param['password'] = $_POST['password'];
    $param['nickname'] = $_POST['nickname'];
    $param['project'] = $_POST['project'];
    $userId = FCurl::get('user/createUserAccount', $param);
    if (isset($_FILES['photo']) && $_FILES['photo']['error'] == 0) {
        #存在上传头像文件且上传成功
        $filePath = 'avatar/' . $userId . '_' . md5_file($_FILES['photo']['tmp_name']) . '.' . end(explode('.', $_FILES['photo']['name']));
        #修正图片大小
        require_once 'lib/photo.class.php';
        $photoTool = new photo();
        $photoTool->copyImageWithSize($_FILES['photo']['tmp_name'], IMG_PATH_BASE . $filePath, 120, 120);
        $param = array();
        $param['userId'] = $userId;
        $param['photo'] = $filePath;
        FCurl::get('user/updateUserPhoto', $param);
        FCurl::header('user_add.php');
    }
}
?>

<nav class="teal lighten-1" role="navigation">
  <div class="nav-wrapper">
    <a id="logo-container" class="dropdown-button brand-logo" href="#!" data-activates="dropdown-quan">添加用户</a>
    <?php 
require_once 'left.php';
?>
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:30,代码来源:user_add.php

示例3: ceil

        if ($photoInfo['width'] > 600) {
            $rate = $photoInfo['width'] / 600;
            $photoInfo['width'] = 600;
            $photoInfo['height'] = ceil($photoInfo['height'] / $rate);
        }
        #根据照片exif信息决定是否旋转
        require_once 'lib/exif.php';
        $exifInfo = GetImageInfo(IMG_PATH_BASE . $filePath);
        if ($exifInfo['方向'] == 'right side top') {
            $photoTool->flip(IMG_PATH_BASE . $filePath, IMG_PATH_BASE . $filePath, -90);
            $widthTmp = $photoInfo['width'];
            $photoInfo['width'] = $photoInfo['height'];
            $photoInfo['height'] = $widthTmp;
        }
        unset($exifInfo);
        $photoTool->copyImageWithSize(IMG_PATH_BASE . $filePath, IMG_PATH_BASE . $filePathSmall, $photoInfo['width'], $photoInfo['height']);
    }
    $param['accessToken'] = $_COOKIE['accessToken'];
    $param['event'] = $_POST['event'];
    $param['id'] = $_POST['id'];
    if (isset($filePathSmall) && $filePathSmall) {
        $param['photo'] = $filePathSmall;
    }
    FCurl::get('group/createEvent', $param);
    FCurl::header('group_info.php?id=' . $groupId);
}
?>

<body>
<?php 
require_once 'blank.php';
开发者ID:NASH-WORK,项目名称:NASH-CRM,代码行数:31,代码来源:group_remark.php


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