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


PHP discuz_upload::is_image_ext方法代码示例

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


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

示例1: get_image_info

 function get_image_info($target, $allowswf = false)
 {
     $ext = discuz_upload::fileext($target);
     $isimage = discuz_upload::is_image_ext($ext);
     if (!$isimage && ($ext != 'swf' || !$allowswf)) {
         return false;
     } elseif (!is_readable($target)) {
         return false;
     } elseif ($imageinfo = @getimagesize($target)) {
         list($width, $height, $type) = !empty($imageinfo) ? $imageinfo : array('', '', '');
         $size = $width * $height;
         if ($size > 16777216 || $size < 16) {
             return false;
         } elseif ($ext == 'swf' && $type != 4) {
             return false;
         } elseif ($isimage && !in_array($type, array(1, 2, 3, 6, 13))) {
             return false;
         }
         return $imageinfo;
     } else {
         return false;
     }
 }
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:23,代码来源:class_upload.php

示例2: array

         $temp[] = array('0' => $value[0], '1' => trim($value[2]));
     }
 }
 require_once libfile('class/image');
 if (is_array($temp) && !empty($temp)) {
     $upload = new discuz_upload();
     $attachaids = array();
     foreach ($temp as $value) {
         $imageurl = $value[1];
         $hash = md5($imageurl);
         if (strlen($imageurl)) {
             $imagereplace['oldimageurl'][] = $value[0];
             if (!isset($existentimg[$hash])) {
                 $existentimg[$hash] = $imageurl;
                 $attach['ext'] = $upload->fileext($imageurl);
                 if (!$upload->is_image_ext($attach['ext'])) {
                     continue;
                 }
                 $content = '';
                 if (preg_match('/^(http:\\/\\/|\\.)/i', $imageurl)) {
                     $content = dfsockopen($imageurl);
                 } elseif (preg_match('/^(' . preg_quote(getglobal('setting/attachurl'), '/') . ')/i', $imageurl)) {
                     $imagereplace['newimageurl'][] = $value[0];
                 }
                 if (empty($content)) {
                     continue;
                 }
                 $patharr = explode('/', $imageurl);
                 $attach['name'] = trim($patharr[count($patharr) - 1]);
                 $attach['thumb'] = '';
                 $attach['isimage'] = $upload->is_image_ext($attach['ext']);
开发者ID:vanloswang,项目名称:DiscuzX,代码行数:31,代码来源:forum_ajax.php

示例3: forum_downremotefile

function forum_downremotefile($arr, $old_arr)
{
    global $_G;
    $evo_img_no = $_G['cache']['evn_milu_pick']['evo_img_no'];
    $config = get_pick_set();
    $get_file_ext_arr = $config['get_file_ext'] ? explode('|', $config['get_file_ext']) : array();
    $arr['is_download_file'] = $arr['is_download_file'] ? $arr['is_download_file'] : $arr['p_arr']['is_download_file'];
    $arr['message'] = dstripslashes($arr['content']);
    //print_r($arr);
    //$arr['message'] = str_replace(array("\r", "\n"), array($_GET['wysiwyg'] ? '<br />' : '', "\\n"), $arr['message']);
    preg_match_all("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $arr['message'], $image1, PREG_SET_ORDER);
    //preg_match_all("/\<img.+src=('|\"|)?(.*)(\\1)([\s].*)?\>/ismUe", $arr['message'], $image2, PREG_SET_ORDER);
    preg_match_all("/\\<img.+src=('|\"|)?(.*)(\\1)(.*)?\\>/isU", $arr['message'], $image2, PREG_SET_ORDER);
    $temp = $aids = $existentimg = $attach_arr = array();
    if (is_array($image1) && !empty($image1)) {
        foreach ($image1 as $value) {
            $v = trim(!empty($value[1]) ? $value[1] : $value[2]);
            $no_remote = 0;
            if (!filter_something($v, $evo_img_no)) {
                //存在
                $no_remote = 1;
            }
            if ($no_remote == 0) {
                $temp[] = array('0' => $value[0], '1' => $v);
            }
        }
    }
    if (is_array($image2) && !empty($image2)) {
        foreach ($image2 as $v) {
            $no_remote = 0;
            $v[2] = trim(strip_tags($v[2]));
            if (!filter_something($v[2], $evo_img_no)) {
                //存在
                $no_remote = 1;
            }
            if ($no_remote == 0) {
                $temp[] = array('0' => $v[0], '1' => $v[2]);
            }
        }
    }
    if ($arr['is_download_file'] == 1) {
        $attach_arr = get_attach_data($arr['page_url'], $arr['message']);
    }
    $attach_arr = $attach_arr ? $attach_arr : array();
    $temp = $temp ? $temp : array();
    $temp = array_merge($temp, $attach_arr);
    //if(VIP) $arr['message'] = post($arr['message'], array('cookie' => $arr['cookie'], 'page_url' => $arr['page_url'], 'cid' => $arr['cid']));
    $del_a = 0;
    if ($arr['content_filter_html'][0] == 0 && $arr['content_filter_html']) {
        $del_a = 1;
    }
    //print_r($arr['message']);exit();
    require_once libfile('class/image');
    if (is_array($temp) && !empty($temp)) {
        if (file_exists(libfile('class/upload'))) {
            require_once libfile('class/upload');
        } else {
            require_once libfile('discuz/upload', 'class');
        }
        $upload = new discuz_upload();
        $attachaids = array();
        $threadimage_flag = 0;
        $content_md5_arr = array();
        foreach ($temp as $key => $value) {
            $snoopy_args['cookie'] = $arr['cookie'];
            $snoop_obj = get_snoopy_obj($snoopy_args);
            $imageurl = $value[1];
            $hash = md5($imageurl);
            if (strlen($imageurl)) {
                $imagereplace['oldimageurl'][] = $value[0];
                if (!isset($existentimg[$hash])) {
                    $existentimg[$hash] = $imageurl;
                    $attach['ext'] = $upload->fileext($imageurl);
                    if ($upload->is_image_ext($attach['ext']) == 1 && $arr['is_download_img'] != 1) {
                        $imagereplace['newimageurl'][] = $value[0];
                        continue;
                    }
                    if (!$upload->is_image_ext($attach['ext'])) {
                        $ext = 'no_get';
                    }
                    if (preg_match('/^(http:\\/\\/|\\.)/i', $imageurl)) {
                        if ($imageurl && snoop_obj) {
                            $content_re = get_img_content($imageurl, $snoop_obj, $ext);
                        }
                        if (is_array($content_re)) {
                            $content = $content_re['content'];
                            $file_name = $attach['name'] = $content_re['file_name'] ? $content_re['file_name'] : ($value[2] ? _striptext($value[2]) : time() . '.' . $content_re['file_ext']);
                            $attach['ext'] = $content_re['file_ext'] ? $content_re['file_ext'] : trim($upload->fileext($file_name));
                            $file_name = $attach['name'] = $file_name;
                        } else {
                            $content = $content_re;
                        }
                        if (in_array(md5($content), $content_md5_arr)) {
                            $imagereplace['newimageurl'][] = '';
                            continue;
                        }
                        $content_md5_arr[] = md5($content);
                    } elseif (preg_match('/^(' . preg_quote(getglobal('setting/attachurl'), '/') . ')/i', $imageurl)) {
                        $imagereplace['newimageurl'][] = $value[0];
                    }
//.........这里部分代码省略.........
开发者ID:edmundwong,项目名称:V604,代码行数:101,代码来源:function.article.php


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