• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getThumbImage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getThumbImage函数的典型用法代码示例。如果您正苦于以下问题:PHP getThumbImage函数的具体用法?PHP getThumbImage怎么用?PHP getThumbImage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getAtlasThumbImageById

function getAtlasThumbImageById($cover_id, $width = 100, $height = 'auto', $type = 0, $replace = false)
{
    $picture = S('picture_' . $cover_id);
    if (empty($picture)) {
        $picture = M('Picture')->where(array('status' => 1))->getById($cover_id);
        S('picture_' . $cover_id, $picture);
    }
    if (empty($picture)) {
        return getRootUrl() . 'Public/images/nopic.png';
    }
    switch ($picture['type']) {
        case 'qiniu':
            $height = $height == 'auto' ? 0 : $height;
            $qiniuConfig = C('UPLOAD_QINIU_CONFIG');
            if (stripos($picture['path'], 'imageMogr2') !== false) {
                $picture['path'] = $picture['path'] . '/thumbnail/' . $width . 'x' . $height;
            } else {
                $width = $width ? 'w/' . $width : '';
                $height = $height ? '/h/' . $height : '';
                $picture['path'] = $picture['path'] . '?imageView/' . $type . '/' . $width . $height;
            }
            return 'http://' . $qiniuConfig['domain'] . '/' . $picture['path'];
            //return $picture['path'];
            break;
        case 'local':
            $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
            $attach['src'] = getRootUrl() . $attach['src'];
            return $attach['src'];
        case 'sae':
            $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
            return $attach['src'];
        default:
            return $picture['path'];
    }
}
开发者ID:chenyongze,项目名称:bighaha,代码行数:35,代码来源:function.php


示例2: getImageUrlByPath

 private function getImageUrlByPath($path, $size)
 {
     //TODO 重新开启缩略
     $thumb = getThumbImage($path, $size, $size, 0, true);
     // $thumb['src']=$path;
     $thumb = $thumb['src'];
     if (!is_sae()) {
         $thumb = getRootUrl() . $thumb;
     }
     return $thumb;
 }
开发者ID:smartymoon,项目名称:e-anjia,代码行数:11,代码来源:UploadAvatarWidget.class.php


示例3: getImageUrl

function getImageUrl($file, $width = '0', $height = 'auto', $cut = false, $replace = false)
{
    $cloud = model('CloudImage');
    if ($cloud->isOpen()) {
        $imageUrl = $cloud->getImageUrl($file, $width, $height, $cut);
    } else {
        if ($width > 0) {
            $thumbInfo = getThumbImage($file, $width, $height, $cut, $replace);
            $imageUrl = UPLOAD_URL . '/' . ltrim($thumbInfo['src'], '/');
        } else {
            $imageUrl = UPLOAD_URL . '/' . ltrim($file, '/');
        }
    }
    return $imageUrl;
}
开发者ID:ElijahLabs,项目名称:ThinkSNS-4,代码行数:15,代码来源:functions.inc.php


示例4: saveUploadAvatar

 /**
  * 保存Flash提交的数据 - flash上传
  * @param  array $data        用户头像的相关信息
  * @param  array $oldUserInfo 貌似无用字段,与此flash组件有关
  * @return bool  是否保存成功
  */
 public function saveUploadAvatar($data, $oldUserInfo)
 {
     $original_file_name = '/avatar' . $this->convertUidToPath($this->_uid) . '/original.jpg';
     // Log::write(var_export($data,true));
     //如果是又拍上传
     $cloud = model('CloudImage');
     if ($cloud->isOpen()) {
         @$cloud->deleteFile($original_file_name);
         //重新上传新头像原图
         $imageAsString = $data['big'];
         $res = $cloud->writeFile($original_file_name, $imageAsString, true);
     } else {
         $res = file_put_contents(UPLOAD_PATH . $original_file_name, $data['big']);
         getThumbImage($original_file_name, 200, 200, true, true);
         getThumbImage($original_file_name, 100, 100, true, true);
         getThumbImage($original_file_name, 50, 50, true, true);
         getThumbImage($original_file_name, 30, 30, true, true);
     }
     if (!$res) {
         return false;
     } else {
         // 清理用户缓存
         model('User')->cleanCache($this->_uid);
         return true;
     }
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:32,代码来源:AvatarModel.class.php


示例5: getThumbImageById

function getThumbImageById($cover_id, $width = 100, $height = 'auto', $type = 0, $replace = false)
{
    $picture = M('Picture')->where(array('status' => 1))->getById($cover_id);
    if (empty($picture)) {
        return getRootUrl() . 'Public/Core/images/nopic.png';
    }
    switch ($picture['type']) {
        case 'qiniu':
            $height = $height == 'auto' ? 100 : $height;
            if (stripos($picture['path'], 'imageMogr2') !== false) {
                $picture['path'] = $picture['path'] . '/thumbnail/' . $width . 'x' . $height;
            } else {
                $picture['path'] = $picture['path'] . '?imageView/1/w/' . $width . '/h/' . $height;
            }
            return $picture['path'];
            break;
        case 'local':
            $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
            $attach['src'] = getRootUrl() . $attach['src'];
            return $attach['src'];
        case 'sae':
            $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
            return $attach['src'];
        default:
            return $picture['path'];
    }
}
开发者ID:fishling,项目名称:chatPro,代码行数:27,代码来源:thumb.php


示例6: getThumbImageById

function getThumbImageById($cover_id, $width = 100, $height = 'auto', $type = 0, $replace = false)
{
    $picture = S('picture_' . $cover_id);
    if (empty($picture)) {
        $picture = M('Picture')->where(array('status' => 1))->getById($cover_id);
        S('picture_' . $cover_id, $picture);
    }
    if (empty($picture)) {
        return get_pic_src('Public/images/nopic.png');
    }
    if ($picture['type'] == 'local') {
        $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
        return get_pic_src($attach['src']);
    } else {
        $new_img = $picture['path'];
        $name = get_addon_class($picture['type']);
        if (class_exists($name)) {
            $class = new $name();
            if (method_exists($class, 'thumb')) {
                $new_img = $class->thumb($picture['path'], $width, $height, $type, $replace);
            }
        }
        return get_pic_src($new_img);
    }
}
开发者ID:ccccy,项目名称:wuanlife,代码行数:25,代码来源:thumb.php


示例7: save

 /**
 +----------------------------------------------------------
 * 上传一个文件
 +----------------------------------------------------------
 +----------------------------------------------------------
 * @param mixed  $name  数据
 * @param string $value 数据表名
 +----------------------------------------------------------
 * @return string
 +----------------------------------------------------------
 * @throws ThinkExecption
 +----------------------------------------------------------
 */
 private function save($file)
 {
     $filename = $file['savepath'] . $file['savename'];
     if (!$this->uploadReplace && is_file($filename)) {
         // 不覆盖同名文件
         $this->error = '文件已经存在!' . $filename;
         return false;
     }
     $saveFileName = auto_charset($filename, 'utf-8', 'gbk');
     if (!move_uploaded_file($file['tmp_name'], $saveFileName)) {
         $this->error = '文件上传保存错误!';
         return false;
     }
     if ($this->thumb) {
         //是否主动生成缩略图 不建议开启
         getThumbImage($saveFileName, 800, 800, false, true);
         // getThumbImage($saveFileName,100,100);
         // getThumbImage($saveFileName,300,300);
     }
     if ($this->zipImags) {
         // TODO 对图片压缩包在线解压
     }
     //由于很多时候,后台不需要水印,所以需要水印的在应用中自己实现,参考如下代码
     //require_cache(SITE_PATH."/addons/library/WaterMark/WaterMark.class.php");
     //WaterMark::iswater($filename);
     return true;
 }
开发者ID:medz,项目名称:thinksns-4,代码行数:40,代码来源:UploadFile.class.php


示例8: getThumbImageById

function getThumbImageById($cover_id, $width = 100, $height = 2, $type = 0, $replace = false)
{
    $picture = M('Picture')->where(array('status' => 1))->getById($cover_id);
    if (empty($picture)) {
        return getRootUrl() . 'Public/static/assets/img/nopic.png';
    }
    $attach = getThumbImage($picture['path'], $width, $height, $type, $replace);
    if (!is_sae()) {
        $attach['src'] = getRootUrl() . $attach['src'];
    }
    return $attach['src'];
}
开发者ID:yaomoo,项目名称:bbs,代码行数:12,代码来源:thumb.php


示例9: getImageUrlApp

function getImageUrlApp($file, $width = '0', $height = 'auto', $cut = false, $replace = false)
{
    $cloud = model('CloudImage');
    if ($cloud->isOpen()) {
        $imageUrl = $cloud->getImageUrl($file, $width, $height, $cut);
    } else {
        if ($width > 0) {
            $thumbInfo = getThumbImage($file, $width, $height, $cut, $replace);
            $imageUrl = C('TS_UPDATE_SITE') . '/data/upload/' . ltrim($thumbInfo['src'], '/');
        } else {
            $imageUrl = C('TS_UPDATE_SITE') . '/data/upload/' . ltrim($file, '/');
        }
    }
    return $imageUrl;
}
开发者ID:omusico,项目名称:ThinkSNS-4,代码行数:15,代码来源:common.php


示例10: FileUpload

function FileUpload($resourceType, $currentFolder, $sCommand)
{
    dbConn();
    $email = getEmailFCK();
    $thumb_widthpx = 160;
    if (!isset($_FILES)) {
        global $_FILES;
    }
    $sErrorNumber = '0';
    $sFileName = '';
    if (isset($_FILES['NewFile']) && !is_null($_FILES['NewFile']['tmp_name']) && $email != "") {
        global $Config;
        $oFile = $_FILES['NewFile'];
        // Map the virtual path to the local server path.
        //$sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ;
        $s = GetRootPath() . $Config['UserTempPath'] . $currentFolder . "/";
        $s = str_replace("\\", "/", $s);
        $sServerDir = $s;
        $f = fopen("log2.txt", "a");
        fwrite($f, "\r\n  s = {$s} \r\n");
        // Get the uploaded file name.
        $sFileName = $oFile['name'];
        $sFileName = SanitizeFileName($sFileName);
        $sOriginalFileName = $sFileName;
        // Get the extension.
        $sExtension = substr($sFileName, strrpos($sFileName, '.') + 1);
        $sExtension = strtolower($sExtension);
        if (isset($Config['SecureImageUploads'])) {
            if (($isImageValid = IsImageValid($oFile['tmp_name'], $sExtension)) === false) {
                $sErrorNumber = '202';
            }
        }
        if (isset($Config['HtmlExtensions'])) {
            if (!IsHtmlExtension($sExtension, $Config['HtmlExtensions']) && ($detectHtml = DetectHtml($oFile['tmp_name'])) === true) {
                $sErrorNumber = '202';
            }
        }
        // Check if it is an allowed extension.
        if (!$sErrorNumber && IsAllowedExt($sExtension, $resourceType)) {
            $iCounter = 0;
            while (true) {
                $sFilePath = $sServerDir . "/" . $sFileName;
                //fwrite($f, "\r\n sFilePath = $sFilePath \r\n");
                //fwrite($f, "\nsServerDir = $sServerDir\n");
                if (is_file($sFilePath)) {
                    $iCounter++;
                    $sFileName = RemoveExtension($sOriginalFileName) . '(' . $iCounter . ').' . $sExtension;
                    $sErrorNumber = '201';
                } else {
                    move_uploaded_file($oFile['tmp_name'], $sFilePath);
                    if (is_file($sFilePath)) {
                        $ftype = $_FILES['NewFile']['type'];
                        $file_size = $_FILES['NewFile']['size'];
                        $originalpic = file_get_contents($sFilePath);
                        list($width, $height) = getimagesize($sFilePath);
                        if ($width > $thumb_widthpx) {
                            $count = 1;
                            $p = str_replace($sFileName, "", $sFilePath, $count);
                            //fwrite($f, "\r\nfpath: $sFilePath\r\n");
                            $thumbpic = getThumbImage($p, $thumb_widthpx, $sFileName);
                        } else {
                            $thumbpic = $originalpic;
                            unlink($sFilePath);
                        }
                        $album_id = getAlbumId($email);
                        $table = 'user_imgs';
                        $fields = array('id', 'user_email', 'large_image', 'thumb_image', 'file_type', 'stat', 'file_name', 'file_size', 'album_id', 'admin_perm', 'view_count', 'rating');
                        $values = array(null, $email, $originalpic, $thumbpic, $ftype, 1, $sFileName, $file_size, $album_id, 1, 0, 0);
                        $rs = insertData($table, $fields, $values);
                        if (is_string($rs) || $rs == false) {
                            //$sErrorNumber = '202' ;
                            //file_put_contents("$sFileName", $thumbpic);
                        } else {
                            //fwrite($f, "is inserted = true");
                        }
                        if (isset($Config['ChmodOnUpload']) && !$Config['ChmodOnUpload']) {
                            break;
                        }
                        $permissions = 0777;
                        if (isset($Config['ChmodOnUpload']) && $Config['ChmodOnUpload']) {
                            $permissions = $Config['ChmodOnUpload'];
                        }
                        $oldumask = umask(0);
                        chmod($sFilePath, $permissions);
                        umask($oldumask);
                    }
                    break;
                }
            }
            if (file_exists($sFilePath)) {
                //previous checks failed, try once again
                if (isset($isImageValid) && $isImageValid === -1 && IsImageValid($sFilePath, $sExtension) === false) {
                    @unlink($sFilePath);
                    $sErrorNumber = '202';
                } else {
                    if (isset($detectHtml) && $detectHtml === -1 && DetectHtml($sFilePath) === true) {
                        @unlink($sFilePath);
                        $sErrorNumber = '202';
                    }
                }
//.........这里部分代码省略.........
开发者ID:aazhbd,项目名称:ArtCms,代码行数:101,代码来源:commands.php


示例11: cut

 public function cut()
 {
     // $img = 'test.jpg';
     // $info = getThumbImage($img,100,100,true);
     // dump($info);
     // exit;
     // array(7) {
     //   ["dirname"] => string(1) "."
     //   ["basename"] => string(8) "test.jpg"
     //   ["extension"] => string(3) "jpg"
     //   ["filename"] => string(4) "test"
     //   ["src"] => string(19) "/./test_100_100.jpg"
     //   ["width"] => int(100)
     //   ["height"] => int(100)
     // }
     getThumbImage("./data/upload/2012/0604/19/4fcc9b2f67d34.jpg", '300', 'auto', false);
     echo '<img src="./data/upload/2012/0604/19/4fcc9b2f67d34_300_auto.jpg">';
     echo 11;
 }
开发者ID:lyhiving,项目名称:icampus,代码行数:19,代码来源:TestAction.class.php


示例12: getProfile

 public function getProfile($uid = null)
 {
     //默认查看自己的详细资料
     if (!$uid) {
         $this->requireLogin();
         $uid = $this->getUid();
     }
     //读取数据库中的用户详细资料
     $map = array('uid' => $uid);
     $user1 = D('Home/Member')->where($map)->find();
     $user2 = D('User/UcenterMember')->where(array('id' => $uid))->find();
     //获取头像信息
     $avatar = new AvatarAddon();
     $avatar_path = $avatar->getAvatarPath($uid);
     $avatar_url = getRootUrl() . $avatar->getAvatarPath($uid);
     //缩略头像
     $avatar128_path = getThumbImage($avatar_path, 128);
     $avatar128_path = '/' . $avatar128_path['src'];
     $avatar128_url = getRootUrl() . $avatar128_path;
     //获取等级
     $title = D('Usercenter/Title')->getTitle($user1['score']);
     //只返回必要的详细资料
     $this->apiSuccess("获取成功", null, array('uid' => $uid, 'avatar_url' => $avatar_url, 'avatar128_url' => $avatar128_url, 'signature' => $user1['signature'], 'email' => $user2['email'], 'mobile' => $user2['mobile'], 'score' => $user1['score'], 'name' => $user1['name'], 'sex' => $this->encodeSex($user1['sex']), 'birthday' => $user1['birthday'], 'title' => $title, 'username' => $user2['username']));
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:24,代码来源:UserController.class.php


示例13: get_sc

function get_sc($pic_path, $width = 150, $height = 150, $cut = true, $replace = false)
{
    $attach = getThumbImage($pic_path, $width, $height, $cut, $replace);
    return $attach['src'];
}
开发者ID:dualzero,项目名称:paikezone,代码行数:5,代码来源:function.php


示例14: getImageUrlByPath

 private function getImageUrlByPath($path, $size, $isReplace = true)
 {
     $thumb = getThumbImage($path, $size, $size, 0, $isReplace);
     return get_pic_src($thumb['src']);
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:5,代码来源:UploadAvatarWidget.class.php


示例15: siteAvatar

 /**
  *  远程文件生成本地头像
  * @param $imgurl str 远程图像路径
  *
  * @return bool
  */
 private function siteAvatar($imgurl, $uid)
 {
     // var_dump($imgurl);die;
     //$imgurl = "http://upload.iheima.com/2015/0818/1439882597999.jpg";
     if (!empty($imgurl)) {
         set_time_limit(0);
         $get_file = @file_get_contents($imgurl);
         if ($get_file) {
             //图片目录 及名称
             $imgPath = UPLOAD_PATH . '/' . date('Y/md/H', time());
             $imgname = $imgPath . '/' . uniqid() . strrchr($imgurl, ".");
             if (!is_dir($imgPath)) {
                 mkdir($imgPath, 0777, true);
             }
             $fp = @fopen($imgname, "w");
             @fwrite($fp, $get_file);
             @fclose($fp);
             //添加进附件表
             $imgsize = getimagesize($imgname);
             $type = $imgsize['mime'];
             $width = $imgsize[0];
             $height = $imgsize[1];
             $size = filesize($imgname);
             $name = array_pop(explode('/', $imgurl));
             $extension = array_pop(explode('.', $imgurl));
             $hash = md5(C('SECURE_CODE') . get_client_ip() . $uniqid);
             $save_path = date('Y/md/H/', time());
             $save_name = uniqid() . strrchr($imgurl, ".");
             $map['attach_type'] = 'avatar';
             $map['uid'] = $uid;
             $map['name'] = $name;
             $map['type'] = $type;
             $map['size'] = $size;
             $map['extension'] = $extension;
             $map['hash'] = $hash;
             $map['save_path'] = $save_path;
             $map['save_name'] = $save_name;
             $map['ctime'] = time();
             $map['width'] = $width;
             $map['height'] = $height;
             $aid = D('Attach')->add($map);
             //头像目录 及名称
             $sitepath = model('Avatar')->convertUidToPath($uid);
             $avatarpath = UPLOAD_PATH . '/avatar' . $sitepath;
             $avatarname = $avatarpath . '/original.jpg';
             if (!is_dir($avatarpath)) {
                 mkdir($avatarpath, 0777, true);
             }
             $ap = @fopen($avatarname, "w");
             @fwrite($ap, $get_file);
             @fclose($ap);
             //生成四个尺寸的缩略图
             $jqimg = '/avatar' . $sitepath . '/original.jpg';
             getThumbImage($jqimg, 200, 200, true, true);
             getThumbImage($jqimg, 100, 100, true, true);
             getThumbImage($jqimg, 50, 50, true, true);
             getThumbImage($jqimg, 30, 30, true, true);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:songhongyu,项目名称:THINKSNS,代码行数:71,代码来源:PassportAction.class.php


示例16: getThumbImageById

function getThumbImageById($cover_id, $width = 100, $height = 'auto', $cut = true, $replace = false)
{
    $picture = M('Picture')->where(array('status' => 1))->getById($cover_id);
    if (empty($picture)) {
        return 'Public/Core/image/nopic.jpg';
    }
    $attach = getThumbImage($picture['path'], $width, $height, $cut, $replace);
    return $attach['src'];
}
开发者ID:nullog,项目名称:zhanglubao,代码行数:9,代码来源:thumb.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getThumbImageById函数代码示例发布时间:2022-05-15
下一篇:
PHP getThings函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap