> php教程 > PHP源码 > discuz的image类使用

discuz的image类使用

PHP中文网
풀어 주다: 2016-05-25 17:12:28
원래의
1285명이 탐색했습니다.


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

//文件域的名字

//处理方法

//新图

            if(!empty($_FILES['attach']['tmp_name']) && is_uploaded_file($_FILES['attach']['tmp_name'])){

                $query = DB::query("select filename,filepath from pre_home_hall_pic where picid =$picid ");            

                while ($value = DB::fetch($query)) {

                    $oldfilepath=$value['filepath'];

                    $filename =$value['filename'];

                }

                $file_info = pathinfo($_FILES['attach']['name']);

                $ext = $file_info['extension'];// 取扩展名

 

                $filepath = dirname($oldfilepath).'/'.date('His').strtolower(random(16)).'.'.$ext;//随机重命名          

                $uploadpath = 'data/attachment/hall/'.$filepath;               

                if(!is_dir('data/attachment/hall/'.$oldfilepath)){

                    unlink('data/attachment/hall/'.$oldfilepath);

                    unlink('data/attachment/hall/'.$oldfilepath.'.thumb.jpg');             

                }

                $res = move_uploaded_file($_FILES['attach']['tmp_name'], $uploadpath);

                if($res){

                    require_once libfile('class/image');

                    $image = new image();

                    $result = $image->Thumb($uploadpath, '', 140, 140, 1);                      

                }

                $data['filename'] = $_FILES['attach']['name'];

                $data['filepath'] = $filepath;                     

            }

            DB::update('home_hall_pic', $data, $wherearr);

로그인 후 복사

                   

관련 라벨:
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 추천
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿