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


PHP PwUpload::makeThumb方法代码示例

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


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

示例1: upload

 function upload(&$bhv)
 {
     $uploaddb = array();
     foreach ($_FILES as $key => $value) {
         if (!PwUpload::if_uploaded_file($value['tmp_name']) || !$bhv->allowType($key)) {
             continue;
         }
         $atc_attachment = $value['tmp_name'];
         $upload = PwUpload::initCurrUpload($key, $value);
         if (empty($upload['ext']) || !isset($bhv->ftype[$upload['ext']])) {
             uploadmsg('upload_type_error');
         }
         if ($upload['size'] < 1 || $upload['size'] > $bhv->ftype[$upload['ext']] * 1024) {
             $GLOBALS['atc_attachment_name'] = $upload['name'];
             $GLOBALS['oversize'] = $bhv->ftype[$upload['ext']];
             uploadmsg($upload['size'] < 1 ? 'upload_size_0' : 'upload_size_error');
         }
         list($filename, $savedir, $thumbname, $thumbdir) = $bhv->getFilePath($upload);
         $upload['fileuploadurl'] = $savedir . $filename;
         $source = PwUpload::savePath($bhv->ifftp, $filename, $savedir);
         $thumburl = PwUpload::savePath($bhv->ifftp, $thumbname, $thumbdir, 'thumb_');
         if (!PwUpload::postupload($atc_attachment, $source)) {
             uploadmsg('upload_error');
         }
         $upload['size'] = ceil(filesize($source) / 1024);
         if (in_array($upload['ext'], array('gif', 'jpg', 'jpeg', 'png', 'bmp', 'swf'))) {
             require_once R_P . 'require/imgfunc.php';
             if (!($img_size = GetImgSize($source, $upload['ext']))) {
                 P_unlink($source);
                 uploadmsg('upload_content_error');
             }
             if ($upload['ext'] != 'swf') {
                 if ($bhv->allowThumb()) {
                     $thumbsize = PwUpload::makeThumb($source, $thumburl, $bhv->getThumbSize(), $upload['ifthumb']);
                 }
                 if ($bhv->allowWaterMark()) {
                     PwUpload::waterMark($source, $upload['ext'], $img_size);
                     $upload['ifthumb'] && PwUpload::waterMark($thumburl, $upload['ext']);
                 }
                 $upload['type'] = 'img';
             }
         } elseif ($upload['ext'] == 'txt') {
             if (preg_match('/(onload|submit|post|form)/i', readover($source))) {
                 P_unlink($source);
                 uploadmsg('upload_content_error');
             }
             $upload['type'] = 'txt';
         }
         if ($bhv->ifftp) {
             PwUpload::movetoftp($source, $upload['fileuploadurl']);
             $upload['ifthumb'] && PwUpload::movetoftp($thumburl, $thumbdir . $thumbname);
         }
         $uploaddb[] = $upload;
     }
     $bhv->update($uploaddb);
 }
开发者ID:adi00,项目名称:wumaproject,代码行数:56,代码来源:upload.class.php

示例2: operateImage

 /**
  * @static
  */
 function operateImage($source, $filename, $savedir, $upload, $bhv)
 {
     require_once R_P . 'require/imgfunc.php';
     if (!($img_size = GetImgSize($source, $upload['ext']))) {
         P_unlink($source);
         showUploadMsg('upload_content_error');
     }
     $thumbInfo = array();
     $ifthumb = 0;
     if ($upload['ext'] != 'swf') {
         if ($bhv->allowThumb() && $upload['ext'] != 'gif') {
             $thumbInfo = PwUpload::makeThumb($source, $bhv->getThumbInfo($filename, $savedir), $bhv->ifftp, $ifthumb);
         }
         $bhv->allowWaterMark() && PwUpload::waterMark($source, $upload['ext'], $img_size);
         $upload['type'] = 'img';
     }
     return array($thumbInfo, $ifthumb, $upload['type']);
 }
开发者ID:sherlockhouse,项目名称:aliyun,代码行数:21,代码来源:ver.customized.upload.php

示例3: transfer

 function transfer()
 {
     global $attachdir, $db_enhideset, $db_sellset, $db_ifpwcache;
     if (!$this->flashatt) {
         return false;
     }
     $flattids = array_keys($this->flashatt);
     $attach = $this->pw_attachs->gets(array('tid' => 0, 'pid' => 0, 'uid' => $this->post->uid, 'aid' => $flattids));
     foreach ($attach as $rt) {
         $value = $this->flashatt[$rt['aid']];
         $rt['ifthumb'] = 0;
         $rt['descrip'] = $value['desc'];
         $rt['special'] = intval($value['special']);
         $rt['needrvrc'] = intval($value['needrvrc']);
         $rt['ctype'] = $value['ctype'];
         $rt['ext'] = strtolower(substr(strrchr($rt['name'], '.'), 1));
         $srcfile = "{$attachdir}/mutiupload/{$rt['attachurl']}";
         $rt['fileuploadurl'] = $filename = $thumbname = preg_replace('/^0_/', "{$this->forum->fid}_", $rt['attachurl']);
         $thumbdir = 'thumb/';
         if ($savedir = $this->getSaveDir($rt['ext'])) {
             $rt['fileuploadurl'] = $savedir . $filename;
             $thumbdir .= $savedir;
         }
         $source = PwUpload::savePath(0, $filename, $savedir);
         $thumburl = PwUpload::savePath($this->ifftp, $thumbname, $thumbdir, 'thumb_');
         if (in_array($rt['ext'], array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
             require_once R_P . 'require/imgfunc.php';
             if (!($img_size = GetImgSize($srcfile, $rt['ext']))) {
                 Showmsg('upload_content_error');
             }
             if ($this->allowThumb()) {
                 $thumbsize = PwUpload::makeThumb($srcfile, $thumburl, $this->getThumbSize(), $rt['ifthumb']);
             }
             if ($this->allowWaterMark()) {
                 PwUpload::waterMark($srcfile, $rt['ext'], $img_size);
                 $rt['ifthumb'] && PwUpload::waterMark($thumburl, $rt['ext']);
             }
         }
         if ($this->ifftp) {
             if (!PwUpload::movetoftp($srcfile, $rt['fileuploadurl'])) {
                 continue;
             }
             $rt['ifthumb'] && PwUpload::movetoftp($thumburl, "thumb/{$rt['fileuploadurl']}");
         } else {
             if (!PwUpload::movefile($srcfile, $source)) {
                 continue;
             }
         }
         $this->attachs[$rt['aid']] = array('aid' => $rt['aid'], 'name' => $rt['name'], 'type' => $rt['type'], 'attachurl' => $rt['fileuploadurl'], 'needrvrc' => 0, 'special' => 0, 'ctype' => '', 'size' => $rt['size'], 'hits' => $rt['hits'], 'desc' => str_replace('\\', '', $rt['descrip']), 'ifthumb' => $rt['ifthumb']);
         $pwSQL = array('fid' => $this->forum->fid, 'attachurl' => $rt['fileuploadurl'], 'descrip' => $rt['descrip'], 'ifthumb' => $rt['ifthumb']);
         if ($rt['needrvrc'] > 0 && ($rt['special'] == 1 && $this->post->allowencode && in_array($rt['ctype'], $db_enhideset['type']) || $rt['special'] == 2 && $this->post->allowsell && in_array($rt['ctype'], $db_sellset['type']))) {
             $this->attachs[$rt['aid']]['needrvrc'] = $pwSQL['needrvrc'] = $rt['needrvrc'];
             $this->attachs[$rt['aid']]['special'] = $pwSQL['special'] = $rt['special'];
             $this->attachs[$rt['aid']]['ctype'] = $pwSQL['ctype'] = $rt['ctype'];
         }
         $this->post->user['uploadnum']++;
         $this->post->user['uploadtime'] = $timestamp;
         $this->pw_attachs->updateById($rt['aid'], $pwSQL);
         $this->ifupload = $rt['type'] == 'img' ? 1 : ($rt['type'] == 'txt' ? 2 : 3);
         if ($db_ifpwcache & 512 && !$rt['needrvrc'] && $rt['type'] == 'img' && !$this->elementpic) {
             $this->elementpic = array('aid' => $rt['aid'], 'attachurl' => $rt['fileuploadurl'], 'ifthumb' => $rt['ifthumb']);
         }
     }
 }
开发者ID:adi00,项目名称:wumaproject,代码行数:64,代码来源:attupload.class.php


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