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

PHP find_file函数代码示例

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

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



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

示例1: create_data

 function create_data()
 {
     $svg_file = find_file($this->paths['tempdir'], '.svg');
     $return = array();
     if (empty($svg_file)) {
         zn_delete_folder($this->paths['tempdir']);
         $return['message'] = 'The zip did not contained any svg files.';
     }
     $file_data = file_get_contents(trailingslashit($this->paths['tempdir']) . $svg_file);
     if (!is_wp_error($file_data) && !empty($file_data)) {
         $xml = simplexml_load_string($file_data);
         $font_attr = $xml->defs->font->attributes();
         $this->font_name = (string) $font_attr['id'];
         $icon_list = array();
         $glyphs = $xml->defs->font->children();
         $class = '';
         foreach ($glyphs as $item => $glyph) {
             if ($item == 'glyph') {
                 $attributes = $glyph->attributes();
                 $unicode = (string) $attributes['unicode'];
                 $d = (string) $attributes['d'];
                 if ($class != 'hidden' && !empty($d)) {
                     $unicode_key = trim(json_encode($unicode), '\\\\"');
                     if ($item == 'glyph' && !empty($unicode_key) && trim($unicode_key) != '') {
                         $icon_list[$this->font_name][$unicode_key] = $unicode_key;
                     }
                 }
             }
         }
         if (!empty($icon_list) && !empty($this->font_name)) {
             $icon_list_file = fopen($this->paths['tempdir'] . '/icon_list.php', 'w');
             if ($icon_list_file) {
                 fwrite($icon_list_file, '<?php $icons = array();');
                 foreach ($icon_list[$this->font_name] as $unicode) {
                     if (!empty($unicode)) {
                         $delimiter = "'";
                         if (strpos($unicode, "'") !== false) {
                             $delimiter = '"';
                         }
                         fwrite($icon_list_file, "\r\n" . '$icons[\'' . $this->font_name . '\'][' . $delimiter . $unicode . $delimiter . '] = ' . $delimiter . $unicode . $delimiter . ';');
                     }
                 }
                 fclose($icon_list_file);
             } else {
                 zn_delete_folder($this->paths['tempdir']);
                 $return['message'] = 'There was a problem creating the icon list file';
                 return;
             }
             // RENAME ALL FILES SO WE CAN LOAD THEM BY FONT NAME
             $this->rename_files();
             // RENAME THE FOLDER WITH THE FONT NAME
             $this->rename_folder();
             // ADD FONT DATA TO FONT OPTION
             $this->add_font_data();
         }
     } else {
         $return['message'] = 'The svg file could not be opened.';
     }
     return $return;
 }
开发者ID:rock1media,项目名称:wordpress,代码行数:60,代码来源:class-icon-manager.php


示例2: smarty_function_picture

function smarty_function_picture($params, $template)
{
    $src = smarty_plugin_get_variable($params, $template, 'src', true);
    $alt = smarty_plugin_get_variable($params, $template, 'alt');
    $path = smarty_plugin_get_variable($params, $template, 'path');
    $CI =& get_instance();
    $CI->load->helper('image');
    $file = find_file($src, 'static/img/');
    // Try to find the image in static/img
    if ($file == null) {
        // We can't read the file
        $file = find_file($src, 'static/uploads/');
        if ($file == null) {
            $src = 'default.png';
        }
    }
    $size = get_image_size($src);
    $size = $size['width'];
    $attr = $params;
    $medias = array();
    $ret = array();
    $attr['src'] = $src;
    if ($path != '') {
        $attr['path'] = site_url($path);
    }
    $ret[] = '<picture ' . _parse_form_attributes($attr, array()) . ' >';
    foreach ($params as $key => $value) {
        // Check if user has set the customized media
        if (strpos($key, 'media') !== false) {
            $media = str_replace('media', '', $key);
            $medias[] = $media;
            $ret[] = "\t" . '<source src="' . site_url('responsive/size/' . $value . '/' . $src) . '" media="(min-width:' . $media . 'px)">';
            continue;
        }
        $attr[$key] = smarty_plugin_get_variable($params, $template, $key, false);
    }
    if ($path == '') {
        $resolutions = get_ci_config('resolutions');
        foreach ($resolutions as $res) {
            if (array_search($res, $medias) !== false) {
                // If the resolution is already covered
                continue;
            }
            $ret[] = "\t" . '<source src="' . site_url('responsive/size/' . (double) $res / 2880 * (double) $size . '/' . $src) . '" media="(min-width:' . $res . 'px)">';
        }
    }
    $ret[] = "\t" . '<noscript>';
    $ret[] = "\t\t" . '<img src="' . site_url('static/img/' . $src) . '" alt="' . $alt . '">';
    $ret[] = "\t" . '</noscript>';
    $ret[] = '</picture>';
    return implode("\n", $ret);
}
开发者ID:zhaoshengloveqingqing,项目名称:Website,代码行数:52,代码来源:function.picture.php


示例3: find_file

function find_file($dirname, $fname, &$file_path)
{
    $dir = opendir($dirname);
    while ($file = readdir($dir)) {
        if (empty($file_path) && $file != '.' && $file != '..') {
            if (is_dir($dirname . '/' . $file)) {
                find_file($dirname . '/' . $file, $fname, $file_path);
            } else {
                if (file_exists($dirname . '/' . $fname)) {
                    $file_path = $dirname . '/' . $fname;
                    return;
                }
            }
        }
    }
}
开发者ID:semira27,项目名称:Spotters,代码行数:16,代码来源:download.php


示例4: smarty_function_action

function smarty_function_action($params, $template)
{
    $action = get_default($params, 'obj', null);
    $alt = get_default($params, 'alt', '');
    if ($action == null) {
        trigger_error('The obj parameter is required for action!');
        return '';
    }
    if (gettype($action) != 'object' || get_class($action) != 'Action') {
        trigger_error('The obj parameter must be of Class Action!');
        return '';
    }
    $fields = json_decode($action->fields);
    ci_log('The action to show is', $action);
    $data = array();
    $uri = $action->uri();
    if ($uri) {
        $data['href'] = $uri;
    }
    $content = lang($action->label);
    if (isset($action->logo) && $action->logo != '') {
        $data = array('src' => $action->logo, 'path' => '/responsive/size', 'data-toggle' => 'tooltip', 'data-placement' => isset($fields->placement) ? $fields->placement : 'right', 'data-original-title' => $action->label);
        $CI =& get_instance();
        $CI->load->helper('image');
        $file = find_file($data['src'], 'static/img/');
        // Try to find the image in static/img
        if ($file == null) {
            // We can't read the file
            $data['src'] = 'default.png';
        }
        $content = smarty_function_picture($data, $template);
        if (isset($action->controller) && isset($action->method) && $uri) {
            $data['href'] = $uri;
        }
    }
    return build_tag('a', $data, $content);
}
开发者ID:zhaoshengloveqingqing,项目名称:Website,代码行数:37,代码来源:function.action.php


示例5: download_song

 public function download_song($username, $song_url)
 {
     if (!$this->ion_auth->username_check($username)) {
         redirect('errors/page_missing', 'refresh');
     }
     //cached DB call
     $user = $this->cache->model('User_model', 'get_user_info', array($username), 300);
     // keep for 5 minutes
     //$user = $this->User_model->get_user_info($username);
     $where = array('user_id' => $user->id, 'song_url' => $song_url);
     //cached DB call
     $song = $this->cache->model('Song_model', 'get_song_where', array($where), 300);
     // keep for 5 minutes
     //$song = $this->Song_model->get_song_where(array('user_id'=>$user->id,'song_url'=>$song_url));
     if ($this->uri->segment(5) == NULL) {
         redirect(base_url('song/' . $username . '/' . $song_url), 'refresh');
     }
     //hash is set in the url so get the params from the url and compare to the current timestamp
     $hashGiven = $this->uri->segment(5);
     $timestamp = $this->uri->segment(4);
     $ip = $_SERVER['REMOTE_ADDR'];
     $salt = 'fuck!these&other$itesit$hiph0pvip0rd!e';
     $path = $song->file_name;
     $hash = md5($salt . $ip . $timestamp . $path);
     //does the URI->segment(5) hash equal the hash algo from above $hash? is the time from $seg(4) greater than or equal to the current time? if so, proceed, if not, die.
     if ($hashGiven == $hash && $timestamp >= time()) {
         /*****
          *BEGIN DOWNLOAD FILE
          ******/
         define('ALLOWED_REFERRER', '');
         // Download folder, i.e. folder where you keep all files for download.
         // MUST end with slash (i.e. "/" )
         define('BASE_DIR', FCPATH . 'audio_uploads/' . $username . '/');
         // log downloads?  true/false
         define('LOG_DOWNLOADS', FALSE);
         // log file name
         define('LOG_FILE', FCPATH . 'application/logs/downloads.log');
         $allowed_ext = array('mp3' => 'audio/mpeg');
         // If hotlinking not allowed then make hackers think there are some server problems
         if (ALLOWED_REFERRER !== '' && (!isset($_SERVER['HTTP_REFERER']) || strpos(strtoupper($_SERVER['HTTP_REFERER']), strtoupper(ALLOWED_REFERRER)) === false)) {
             die("Internal server error. Please contact system administrator.");
         }
         // Make sure program execution doesn't time out
         // Set maximum script execution time in seconds (0 means no limit)
         set_time_limit(0);
         if (!isset($song) || empty($song)) {
             die("Please specify a song to download.");
         }
         // Get real file name.
         // Remove any path info to avoid hacking by adding relative path, etc.
         $fname = basename($song->file_name);
         // get full file path (including subfolders)
         $file_path = '';
         find_file(BASE_DIR, $fname, $file_path);
         if (!is_file($file_path)) {
             die("File does not exist. Make sure you specified correct file name.");
         }
         // file size in bytes
         $fsize = filesize($file_path);
         // file extension
         $fext = strtolower(substr(strrchr($fname, "."), 1));
         // check if allowed extension
         if (!array_key_exists($fext, $allowed_ext)) {
             die("Not allowed file type.");
         }
         // get mime type
         if ($allowed_ext[$fext] == '') {
             $mtype = '';
             // mime type is not set, get from server settings
             if (function_exists('mime_content_type')) {
                 $mtype = mime_content_type($file_path);
             } else {
                 if (function_exists('finfo_file')) {
                     $finfo = finfo_open(FILEINFO_MIME);
                     // return mime type
                     $mtype = finfo_file($finfo, $file_path);
                     finfo_close($finfo);
                 }
             }
             if ($mtype == '') {
                 $mtype = "application/force-download";
             }
         } else {
             // get mime type defined by admin
             $mtype = $allowed_ext[$fext];
         }
         //REMOVE UNDERSCORES FROM FILENAME
         $asfname = str_replace('_', ' ', $fname);
         // set headers
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: public");
         header("Content-Description: File Transfer");
         header("Content-Type: {$mtype}");
         header("Content-Disposition: attachment; filename=\"{$asfname}\"");
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: " . $fsize);
         // download
         // @readfile($file_path);
//.........这里部分代码省略.........
开发者ID:JamesWuChina,项目名称:hhvip-ci,代码行数:101,代码来源:songs.php


示例6: xmlrpc_find_file

function xmlrpc_find_file($params)
{
    global $FILE_FOUND;
    global $FILE_LISTEN_URL;
    global $FILE_LENGTH;
    global $FILE_ENCODING;
    global $FILE_DURATION;
    $p0 = $params->getParam(0)->scalarval();
    // server ID
    $p1 = $params->getParam(1)->scalarval();
    // Asterisk call ID
    $p2 = $params->getParam(2)->scalarval();
    // QM User ID
    $p3 = $params->getParam(3)->scalarval();
    // Qm user name
    find_file($p0, $p1, $p2, $p3);
    $response = new XML_RPC_Value(array(new XML_RPC_Value($FILE_FOUND, 'boolean'), new XML_RPC_Value($FILE_LISTEN_URL), new XML_RPC_Value($FILE_LENGTH), new XML_RPC_Value($FILE_ENCODING), new XML_RPC_Value($FILE_DURATION)), "array");
    return new XML_RPC_Response($response);
}
开发者ID:J-Rod1988,项目名称:Vicidial,代码行数:19,代码来源:xml_rpc_audio_server_vicidial.php


示例7: checkerror

    checkerror("Source directory doesn't exist or can't be written to.");
}
$ac['SRCDIR'] = $ac['srcdir'];
$ac['WORKDIR'] = $ac['srcdir'];
$ac['ROOTDIR'] = $ac['rootdir'];
$ac['BASEDIR'] = $ac['basedir'];
checkvalue($ac['srcdir']);
checking('for output filename');
checkvalue($ac['OUTPUT_FILENAME']);
checking('whether to include CHM');
$ac['CHMONLY_INCL_BEGIN'] = $ac['CHMENABLED'] == 'yes' ? '' : '<!--';
$ac['CHMONLY_INCL_END'] = $ac['CHMENABLED'] == 'yes' ? '' : '-->';
checkvalue($ac['CHMENABLED']);
checking("for PHP executable");
if ($ac['PHP'] == '' || $ac['PHP'] == 'no') {
    $ac['PHP'] = find_file($php_bin_names);
} else {
    if (file_exists($cygwin_php_bat)) {
        $ac['PHP'] = $cygwin_php_bat;
    }
}
if ($ac['PHP'] == '') {
    checkerror("Could not find a PHP executable. Use --with-php=/path/to/php.");
}
if (!file_exists($ac['PHP']) || !is_executable($ac['PHP'])) {
    checkerror("PHP executable is invalid - how are you running configure? " . "Use --with-php=/path/to/php.");
}
$ac['PHP'] = abspath($ac['PHP']);
checkvalue($ac['PHP']);
checking("for language to build");
if ($ac['LANG'] == '') {
开发者ID:guoyu07,项目名称:NYAF,代码行数:31,代码来源:configure.php


示例8: mysql_result

 $main_heartbeat_active = mysql_result(mysql_query("SELECT * FROM `main_loop_status` WHERE `field_name` = 'main_heartbeat_active' LIMIT 1"), 0, "field_data");
 if ($main_heartbeat_active == FALSE && $datbase_error == FALSE) {
     // Database Initialization
     initialization_database();
     // Check if a custom PHP path is being used
     $php_location = mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'php_location' LIMIT 1"), 0, "field_data");
     if (empty($php_location) == FALSE) {
         // Check to make sure the binary/exe file exist before starting
         if (getenv("OS") == "Windows_NT") {
             if (file_exists($php_location . "php-win.exe") == FALSE) {
                 // Can't start Timekoin, php-win.exe is missing or the path is wrong.
                 // Try to find the file before starting.
                 $find_php = find_file('C:/wamp', 'php-win.exe');
                 if (empty($find_php[0]) == TRUE) {
                     // Not in wamp, search the whole drive
                     $find_php = find_file('C:', 'php-win.exe');
                 }
                 // Filter strings
                 $symbols = array("/");
                 $find_php[0] = str_replace($symbols, "\\", $find_php[0]);
                 // Filter for path setting
                 $symbols = array("php-win.exe");
                 $find_php[0] = str_replace($symbols, "", $find_php[0]);
                 if (empty($find_php[0]) == TRUE) {
                     // Could not find it anywhere :(
                     header("Location: index.php?menu=system&code=98");
                     exit;
                 } else {
                     // Found it! Save location and start Timekoin
                     mysql_query("UPDATE `options` SET `field_data` = '" . addslashes($find_php[0]) . "' WHERE `options`.`field_name` = 'php_location' LIMIT 1");
                 }
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:main.php


示例9: find_file

/**
 * Try to find the file in folder recursively
 *
 * @author Jack
 * @date Sat Feb 21 10:37:11 2015
 * @param folder
 * 		The folder to find the file
 * @param file
 * 		The filename	
 * @param suffix (default null)
 * 		The file extension (only match the same extension)
 * @param blur (default false)
 * 		If using blur, will just locate the filename in the filename, not matching it
 * @return All the matching files
 */
function find_file($folder, $file, $suffix = null, $blur = false)
{
    $ret = array();
    if (is_array($folder)) {
        foreach ($folder as $f) {
            $ret = array_merge($ret, find_file($f, $file, $suffix, $blur));
        }
        return $ret;
    }
    $iterator = new \DirectoryIterator($folder);
    foreach ($iterator as $fileinfo) {
        if ($fileinfo->isDot()) {
            continue;
        }
        if ($fileinfo->isFile()) {
            $name = $fileinfo->getPathname();
            $info = pathinfo($name);
            if ($info && ($suffix == null || $suffix && $info['extension'] == $suffix)) {
                if ($info['filename'] == $file) {
                    $ret[] = $name;
                } else {
                    if ($blur && strpos($info['filename'], $file) !== false) {
                        $ret[] = $name;
                    }
                }
            }
        } else {
            if ($fileinfo->isDir()) {
                $ret = array_merge($ret, find_file($fileinfo->getPathname(), $file, $suffix, $blur));
            }
        }
    }
    return $ret;
}
开发者ID:guitarpoet,项目名称:clips-tool,代码行数:49,代码来源:core_helper.php


示例10: get_image_size

function get_image_size($src)
{
    $CI =& get_instance();
    $CI->load->helper('image');
    $file = find_file($src, 'static/img/');
    // Try to find the image in static/img
    if ($file == null) {
        // We can't read the file
        $file = find_file($src, 'static/uploads/');
        if ($file == null) {
            trigger_error('The responsive image can\'t be found');
            return '';
        }
    }
    if (extension_loaded('imagick')) {
        $img = new Imagick($file);
        return $img->getImageGeometry();
    }
    if (extension_loaded('gd')) {
        $path_parts = pathinfo($file);
        $ext = $path_parts['extension'];
        if ($ext == 'jpg' || $ext == 'jpeg') {
            $src_img = imagecreatefromjpeg($file);
        } else {
            $src_img = imagecreatefrompng($file);
        }
        return array('width' => imageSX($src_img), 'height' => imageSY($src_img));
    }
    return array(0, 0);
}
开发者ID:zhaoshengloveqingqing,项目名称:Website,代码行数:30,代码来源:common_helper.php


示例11: find_file

     // This could take a while
     // Search the entire hard drive looking for the php program
     if (getenv("OS") == "Windows_NT") {
         $find_php = find_file('C:', 'php-win.exe');
         if (empty($find_php[0]) == TRUE) {
             // Try D: if not found on C:
             $find_php = find_file('D:', 'php-win.exe');
         }
         // Filter strings
         $symbols = array("/");
         $find_php[0] = str_replace($symbols, "\\", $find_php[0]);
         // Filter for path setting
         $symbols = array("php-win.exe");
         $find_php[0] = str_replace($symbols, "", $find_php[0]);
     } else {
         $find_php = find_file('/usr', 'php');
     }
     if (empty($find_php[0]) == TRUE) {
         // PHP File not found
         $body_text = options_screen2();
         $body_text .= '<font color="red"><strong>Could NOT locate PHP program file!</strong></font>';
     } else {
         // Save the found php path
         $sql = "UPDATE `options` SET `field_data` = '" . addslashes($find_php[0]) . "' WHERE `options`.`field_name` = 'php_location' LIMIT 1";
         if (mysql_query($sql) == TRUE) {
             $body_text = options_screen2();
             $body_text .= '<font color="blue"><strong>PHP File Location Found & Saved!</strong></font>';
         }
     }
 }
 if ($_GET["newkeys"] == "confirm") {
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:31,代码来源:index.php


示例12: find_all

function find_all($file, $in)
{
    $files = find_file($file, $in);
    $filetypes = find_filetype($file, $in);
    $all_files = array_merge($files, $filetypes);
    return array_unique($all_files);
}
开发者ID:platform-project,项目名称:platform-project,代码行数:7,代码来源:filesystem.php


示例13: find_file

function find_file($dir = '.', $pat = '')
{
    $files = array();
    $dh = opendir($dir);
    $reg = preg_replace(array('/\\./', '/\\*/'), array('\\.', '.*'), $pat);
    while ($file = readdir($dh)) {
        if ($file == '.' || $file == '..') {
            continue;
        }
        if (preg_match('/~$/', $file)) {
            continue;
        }
        $path = preg_replace('/\\.\\//', '', "{$dir}/{$file}");
        if (is_dir($path)) {
            if ($file == "CVS") {
                continue;
            }
            if (!$pat) {
                $files[] = $path;
            }
            $files = array_merge($files, find_file($path, $pat));
        } else {
            if ($pat && !preg_match("/^{$reg}\$/", $file)) {
                continue;
            }
            $files[] = $path;
        }
    }
    closedir($dh);
    return $files;
}
开发者ID:nbuy,项目名称:xoops-modules-eguide,代码行数:31,代码来源:duplicate.php


示例14: create_image_thumbnail

function create_image_thumbnail($orig, $width, $height = 0)
{
    $output_dir = 'application/cache/img/' . $width . 'x' . $height . '/';
    // All the thumbnails is located in cache
    $out_file = find_file($orig, $output_dir);
    // Try to find the file from output dir
    if ($out_file != null) {
        // If the cached file is exists, return it
        return file_get_contents($out_file);
    }
    $file = find_file($orig, 'static/uploads/');
    // Try to find the image in static/img
    if ($file == null) {
        // We can't read the in uploads
        $file = find_file($orig, 'static/img/');
        // Try to find the image in static/img
        if ($file == null) {
            // We can't read the file {
            return null;
        }
    }
    if ($width == 'normal') {
        return file_get_contents($file);
    }
    if (!file_exists($output_dir)) {
        // If the output dir is not exists, then create it
        mkdir($output_dir, 0777, true);
    }
    $path_parts = pathinfo($file);
    $name = $path_parts['filename'];
    $ext = $path_parts['extension'];
    $out_file = FCPATH . $output_dir . $name . '.' . $ext;
    if (extension_loaded('imagick')) {
        $img = new Imagick($file);
        $img->thumbnailImage($width, $height);
        $img->writeImage($out_file);
        return file_get_contents($out_file);
    }
    if (extension_loaded('gd')) {
        ci_log('Thumbnailing file %s using GD', $file);
        if ($ext == 'jpg' || $ext == 'jpeg') {
            $src_img = imagecreatefromjpeg($file);
        } else {
            $src_img = imagecreatefrompng($file);
        }
        $old_x = imageSX($src_img);
        $old_y = imageSY($src_img);
        if ($height == 0) {
            $height = $old_y * $width / $old_x;
        }
        $dst_img = ImageCreateTrueColor($width, $height);
        imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $width, $height, $old_x, $old_y);
        if ($ext == 'jpg' || $ext == 'jpeg') {
            imagejpeg($dst_img, $out_file);
        } else {
            imagepng($dst_img, $out_file);
        }
        imagedestroy($dst_img);
        imagedestroy($src_img);
    }
    return null;
}
开发者ID:zhaoshengloveqingqing,项目名称:Website,代码行数:62,代码来源:image_helper.php


示例15: inner_create_image_thumbnail

function inner_create_image_thumbnail($orig, $width, $height = 0)
{
    $output_dir = 'application/cache/img/' . $width . 'x' . $height . '/';
    // All the thumbnails is located in cache
    $out_file = find_file($orig, $output_dir);
    // Try to find the file from output dir
    if ($out_file != null) {
        // If the cached file is exists, return it
        return $out_file;
    }
    $file = find_img($orig);
    if ($file == null) {
        // We can't read the file {
        return null;
    }
    if ($width == 'normal') {
        return $file;
    }
    if (!file_exists($output_dir)) {
        // If the output dir is not exists, then create it
        mkdir($output_dir, 0777, true);
    }
    $path_parts = pathinfo($file);
    $name = $path_parts['filename'];
    $ext = $path_parts['extension'];
    $out_file = FCPATH . $output_dir . $orig;
    $dir = dirname($out_file);
    if (!file_exists($dir)) {
        mkdir($dir, 0755, true);
    }
    if (extension_loaded('imagick')) {
        Imagick::setResourceLimit(6, 1);
        // Set the thread limit to image magick
        $img = new Imagick($file);
        $img->thumbnailImage($width, $height);
        $img->writeImage($out_file);
        return $out_file;
    }
    if (extension_loaded('gd')) {
        if ($ext == 'jpg' || $ext == 'jpeg') {
            $src_img = imagecreatefromjpeg($file);
        } else {
            $src_img = imagecreatefrompng($file);
        }
        $old_x = imageSX($src_img);
        $old_y = imageSY($src_img);
        if ($height == 0) {
            $height = $old_y * $width / $old_x;
        }
        $dst_img = ImageCreateTrueColor($width, $height);
        imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $width, $height, $old_x, $old_y);
        if ($ext == 'jpg' || $ext == 'jpeg') {
            imagejpeg($dst_img, $out_file);
        } else {
            imagepng($dst_img, $out_file);
        }
        imagedestroy($dst_img);
        imagedestroy($src_img);
        return $out_file;
    }
    return null;
}
开发者ID:zhaoshengloveqingqing,项目名称:Ci,代码行数:62,代码来源:image_helper.php


示例16: find_file

function find_file($dir, $pattern)
{
    // Get a list of all matching files in the current directory
    $files = glob("{$dir}/{$pattern}");
    // Find a list of all directories in the current directory
    foreach (glob("{$dir}/{*}", GLOB_BRACE | GLOB_ONLYDIR) as $sub_dir) {
        $arr = find_file($sub_dir, $pattern);
        // Resursive call
        $files = array_merge($files, $arr);
        // Merge array with files from subdirectory
    }
    return $files;
}
开发者ID:LoveLeAnon,项目名称:timekoin,代码行数:13,代码来源:function.php


示例17: getIncludePaths

    }
    $inc = getIncludePaths();
    foreach ($inc as $pref) {
        if ($pref == "./") {
            continue;
        }
        if (is_file($pref . 'sms3.6/project' . $name)) {
            return $pref . 'sms3.6/project' . $name;
        }
    }
    return false;
}
//----------------------------------------------------------------------------
$uri = $_SERVER['REQUEST_URI'];
$uri = explode('?', $uri);
$file = find_file($uri[0], $dr);
if (is_file($file)) {
    $update_time = filemtime($file);
    $headers = getallheaders();
    //header для типа файла
    $basename = basename($file);
    $ext = substr($basename, strrpos($basename, ".") + 1);
    switch ($ext) {
        case 'css':
            header('Content-Type: text/css;');
            break;
        case 'js':
            header('Content-Type: application/x-javascript;');
            break;
        default:
            header('Content-Type: text/html;');
开发者ID:romlg,项目名称:cms36,代码行数:31,代码来源:gz.php


示例18: find_file

function find_file($dirs, $filename, $exact = false)
{
    $dir = @scandir($dirs);
    if (is_array($dir) and !empty($dir)) {
        foreach ($dir as $file) {
            if ($file !== '.' and $file !== '..') {
                if (is_file($dirs . '/' . $file)) {
                    $filepath = realpath($dirs . '/' . $file);
                    if (!$exact) {
                        $pos = strpos($file, $filename);
                        if ($pos === false) {
                        } else {
                            if (file_exists($filepath) and is_file($filepath)) {
                                echo str_replace($filename, '<span style="color:red;font-weight:bold">' . $filename . '</span>', $filepath) . ' (' . round(filesize($filepath) / 1024) . 'kb)<br />';
                            }
                        }
                    } elseif ($file == $filename) {
                        if (file_exists($filepath) and is_file($filepath)) {
                            echo str_replace($filename, '<span style="color:red;font-weight:bold">' . $filename . '</span>', $filepath) . ' (' . round(filesize($filepath) / 1024) . 'kb)<br />';
                        }
                    }
                } else {
                    find_file($dirs . '/' . $file, $filename, $exact);
                }
            }
        }
    }
}
开发者ID:bsdroot,项目名称:speervi,代码行数:28,代码来源:fonctions_php.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP find_files函数代码示例发布时间:2022-05-15
下一篇:
PHP find_dhcp6c_process函数代码示例发布时间: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