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


PHP getMime函数代码示例

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


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

示例1: getFiles

        function getFiles(){
         $dirname = 'uploads/';
         $dir = 'uploads/*';
         $files = array();
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         foreach (glob($dir) as $file){
           $t = date("M j, Y g:i a", filemtime($file));
           $m = finfo_file($finfo, $file);
           $m = getMime($m);
           $s = filesize($file);
           $n = basename($file);
           $href = "$dirname$n";
				    echo $s;
           $files[] = array("href"=>$href,"name"=>$n, "size"=>$s, "mime"=>$m, "time"=>$t);

         }
         return $files;
       }
开发者ID:rbirky1,项目名称:cmsc433-php-fileManager,代码行数:18,代码来源:index_2.php

示例2: getFiles

function getFiles(){
         $dirname = 'uploads/';
         $dir = 'uploads/*';
         $files = array();
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         foreach (glob($dir) as $file){
           $n = basename($file);
 // chmod( $dirname . $n, 0777);
           $t = date("M j, Y g:i a", filemtime($file));
           $m = finfo_file($finfo, $file);
           $m = getMime($m);
           $s = filesize($file);

           $href = "$dirname$n";
           $thisFile = new FileU($n, $s, $m, $t, $href);
	   $files[] = clone $thisFile;
	  }
         return $files;
       }
开发者ID:rbirky1,项目名称:cmsc433-php-fileManager,代码行数:19,代码来源:index_4.php

示例3: onlyImages

 /**
  * Pass only images to the uploaded file list.
  * Caution, action performs at the calling time.
  *
  * @param null
  * @return UploadedFiles object
  * @see onlyCompressed
  */
 function onlyImages()
 {
     foreach ($this->http_files as $k => $v) {
         $mime = isset($this->cached_mimes[$k]) ? $this->cached_mimes[$k] : ($this->cached_mimes[$k] = getMime($v['tmp_name']));
         if (($pos = strpos($mime, "image")) === false || $pos != 0) {
             $this->http_error_files[$k][] = array('image', $v['name']);
         }
     }
     return $this;
 }
开发者ID:point,项目名称:cassea,代码行数:18,代码来源:UploadedFiles.php

示例4: cropImage

function cropImage($imgPath, $coordX, $coordY, $coordW, $coordH, $text = NULL)
{
    $data = getMime($imgPath);
    $src_img = $data[0];
    $mime = $data[1];
    $img_width_new = 700;
    $img_height_new = 350;
    $new_image = ImageCreateTrueColor($img_width_new, $img_height_new);
    imagecopyresampled($new_image, $src_img, 0, 0, $coordX, $coordY, $coordW, $coordH, $img_width_new, $img_height_new);
    // New save location
    // code to write text to image
    $black = imagecolorallocate($new_image, 0, 0, 0);
    $white = imagecolorallocate($new_image, 255, 255, 255);
    $font = 'arial.ttf';
    $bbox = imagettfbbox(16, 0, $font, $text);
    $x = $bbox[2] + 20;
    imagefilledrectangle($new_image, 5, 5, $x, 40, $black);
    // Add some shadow to the text
    imagettftext($new_image, 16, 0, 11, 31, $black, $font, $text);
    // Add the text
    imagettftext($new_image, 16, 0, 10, 30, $white, $font, $text);
    $new_file_path = $_SESSION['rootDir'] . '/images/slideShow/' . basename($imgPath);
    return create_image($new_image, $new_file_path, $mime, basename($imgPath), 'slide');
}
开发者ID:vinayadahal,项目名称:new_design,代码行数:24,代码来源:sliderController.php

示例5: stream

 function stream()
 {
     $_REQUEST->setType('action', 'string');
     $mime = getMime($this->path);
     while (ob_get_level() > 0) {
         ob_end_clean();
     }
     //ob_start('contentSize');
     //ob_start('ob_gzhandler');
     $last_modified_time = filemtime($this->path);
     $etag = md5_file($this->path);
     $length = $filesize = filesize($this->path);
     $offset = 0;
     if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time || @trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
         header('HTTP/1.1 304 Not Modified');
         exit;
     }
     if (isset($_SERVER['HTTP_RANGE'])) {
         // if the HTTP_RANGE header is set we're dealing with partial content
         // Only supports a single range right now.
         // http://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file
         preg_match('/bytes=(\\d+)-(\\d+)?/', $_SERVER['HTTP_RANGE'], $range);
         $offset = min(intval($range[1]), $filesize - 1);
         // offset starts at 0, hence filesize-1
         if (@intval($range[2]) > 0) {
             $length = min(intval($range[2]), $filesize);
         }
         $length -= $offset;
         header('HTTP/1.1 206 Partial Content');
         header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize);
     }
     header('Etag: "' . $etag . '"');
     header('Content-Length: ' . $length);
     header('Content-Disposition: ' . ($_REQUEST['action'] === 'download' ? 'attachment; ' : '') . 'filename="' . pathinfo($this->path, PATHINFO_BASENAME) . '"');
     header('Content-Transfer-Encoding: binary');
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified_time) . ' GMT');
     header('Content-Type: ' . $mime);
     if ($_REQUEST['action'] == 'download') {
         header('Content-Type: application/force-download', false);
         header('Content-Type: application/download', false);
         header('Content-Description: File Transfer');
     }
     header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 2 * 24 * 3600) . ' GMT');
     header('Cache-Control: private, max-age=172801, must-revalidate');
     #header('Cache-Control: no-cache');
     header('Pragma: cache');
     $fp = fopen($this->path, 'rb');
     if ($fp === false) {
         die;
     }
     // error!! FIXME
     fseek($fp, $offset);
     print fread($fp, $length);
     fclose($fp);
     exit;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:56,代码来源:Image.php

示例6: data_uri

            <div class="row">

				<?php 
if (!isset($_GET["file"])) {
    echo "Please choose a file you want to view!";
} else {
    ?>
                <section class="panel">
                          <header class="panel-heading">
                            <?php 
    echo $_GET["file"];
    ?>
                          </header>
                          <div class="panel-body"><video src="<?php 
    echo data_uri("files/" . $_GET["file"], getMime($_GET["file"]));
    ?>
" class="img-responsive" />
                    </div></section>
                              <?php 
}
?>



			</div><!--/.row-->


                  <div class="widget-foot">
                    <!-- Footer goes here -->
                  </div>
开发者ID:vantezzen,项目名称:synchro,代码行数:30,代码来源:watchvideo.php

示例7: printMime

function printMime($what, $listline)
{
    // --------------
    // Prints the Mime icon
    // --------------
    $mime = getMime($listline);
    if ($what == "icon") {
        echo $mime["mime_icon"];
    } elseif ($what == "type") {
        echo $mime["mime_type"];
    }
}
开发者ID:Jmainguy,项目名称:multicraft_install,代码行数:12,代码来源:skins.inc.php

示例8: getMime

<?php

function getMime($ext)
{
    $types = ['woff' => 'application/x-font-woff', 'woff2' => 'application/x-font-woff2', 'eot' => 'application/vnd.ms-fontobject', 'svg' => 'image/svg+xml', 'ttf' => 'application/x-font-ttf'];
    if (isset($types[$ext])) {
        return $types[$ext];
    }
}
if (PHP_SAPI == 'cli-server') {
    $file = __DIR__ . $_SERVER['REQUEST_URI'];
    $path = pathinfo($_SERVER['SCRIPT_FILENAME']);
    $mime = getMime($path['extension']);
    if ($mime) {
        header('Content-type: ' . $mime);
        readfile($_SERVER['SCRIPT_FILENAME']);
    } elseif (is_file($file)) {
        return false;
    }
}
require __DIR__ . '/../vendor/autoload.php';
// Instantiate the app
$settings = (require __DIR__ . '/../src/settings.php');
$app = new \Slim\App($settings);
// Set up dependencies
require __DIR__ . '/../src/dependencies.php';
// Register middleware
require __DIR__ . '/../src/middleware.php';
// Register routes
require __DIR__ . '/../src/routes.php';
// Run app
开发者ID:corporateanon,项目名称:cisco-twitter,代码行数:31,代码来源:index.php

示例9: createThumbnail

function createThumbnail($imgPath)
{
    $data = getMime($imgPath);
    $src_img = $data[0];
    $mime = $data[1];
    $img_width = imageSX($src_img);
    $img_height = imageSY($src_img);
    $new_size = ($img_width + $img_height) / ($img_width * ($img_height / 200));
    $img_width_new = $img_width * $new_size;
    $img_height_new = $img_height * $new_size;
    $new_image = ImageCreateTrueColor($img_width_new, $img_height_new);
    $background = imagecolorallocate($new_image, 0, 0, 0);
    imagecolortransparent($new_image, $background);
    imagealphablending($new_image, false);
    imagesavealpha($new_image, true);
    imagecopyresampled($new_image, $src_img, 0, 0, 0, 0, $img_width_new, $img_height_new, $img_width, $img_height);
    // New save location
    $new_file_path = $_SESSION['rootDir'] . '/images/thumb/' . basename($imgPath);
    return create_image($new_image, $new_file_path, $mime, basename($imgPath));
}
开发者ID:vinayadahal,项目名称:new_design,代码行数:20,代码来源:tripController.php

示例10: sortContent


//.........这里部分代码省略.........
    if (isset($folderList) && sizeof($folderList)>0) {
        //$tempTree=array();
        foreach ($folderList as $key => $obj) {
            //$tempTree ['all-obj'] = $obj;
            $tempTree ['text'] = $obj['FOLDER_NAME'];
            $tempTree ['id'] = $obj['FOLDER_UID'];
            $tempTree ['folderID'] = $obj['FOLDER_UID'];
            $tempTree ['cls'] = 'folder';
            $tempTree ['draggable'] = true;
            $tempTree ['name'] = $obj['FOLDER_NAME'];
            $tempTree ['type'] = "Directory";
            $tempTree ['is_file'] = false;
            $tempTree ['appDocCreateDate'] = $obj['FOLDER_CREATE_DATE'];
            $tempTree ['qtip'] ='<strong>Directory: </strong>'.$obj['FOLDER_NAME'].
            '<br /><strong>Create Date:</strong> '.$obj['FOLDER_CREATE_DATE'].'';
            $tempTree ['is_writable'] =true;
            $tempTree ['is_chmodable'] =true;
            $tempTree ['is_readable'] =true;
            $tempTree ['is_deletable'] =true;

            if ((isset($_POST['option']) )&& ($_POST['option'] == "gridDocuments")) {
                $tempTree ['icon'] = "/images/documents/extension/folder.png";
            }
            $processListTree [] = $tempTree;
            $tempTree=array();
        }
    } else {
        if ($_POST ['node'] == '/') {
        }
    }

    if (isset($folderContent)) {
        foreach ($folderContent as $key => $obj) {
            $mimeInformation = getMime($obj["APP_DOC_FILENAME"]);

            $tempTree["text"] = $obj["APP_DOC_FILENAME"];
            $tempTree["name"] = $obj["APP_DOC_FILENAME"];
            $tempTree["type"] = $mimeInformation["description"];
            $tempTree["icon"] = $mimeInformation["icon"];

            $tempTree ['appdocid'] = $obj['APP_DOC_UID'];
            $tempTree ['id'] = $obj['APP_DOC_UID_VERSION'];
            $tempTree ['cls'] = 'file';
            //$tempTree ['draggable'] = true;
            $tempTree ['leaf'] = true;
            $tempTree ['is_file'] = true;
            //if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
            //}
            $tempTree ['docVersion'] = $obj['DOC_VERSION'];
            $tempTree ['appUid'] = $obj['APP_UID'];
            $tempTree ['usrUid'] = $obj['USR_UID'];
            $tempTree ['appDocType'] = ucfirst(strtolower($obj['APP_DOC_TYPE']));
            $tempTree ['appDocCreateDate'] = $obj['APP_DOC_CREATE_DATE'];
            $tempTree ['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
            $tempTree ['appDocTags'] = $obj['APP_DOC_TAGS'];
            $tempTree ['appDocTitle'] = $obj['APP_DOC_TITLE'];
            $tempTree ['appDocComment'] = $tempTree ['qtip'] = $obj['APP_DOC_COMMENT'];
            $tempTree ['appDocFileName'] = $obj['APP_DOC_FILENAME'];
            if (isset($obj['APP_NUMBER'])) {
                $tempTree ['appLabel'] = sprintf("%s '%s' (%s)",$obj['APP_NUMBER'],$obj['APP_TITLE'],$obj['STATUS']);
            } else {
                $tempTree ['appLabel'] = "No case related";
            }
            $tempTree ['proTitle'] = $obj['PRO_TITLE'];
            $tempTree ['appDocVersionable'] = 0;
            if (isset($obj['OUT_DOC_VERSIONING'])) {
开发者ID:rrsc,项目名称:processmaker,代码行数:67,代码来源:appFolderAjax.php

示例11: expandNode


//.........这里部分代码省略.........
                    $tempTree ['is_writable'] =true;
                    $tempTree ['is_chmodable'] =true;
                    $tempTree ['is_readable'] =true;
                    $tempTree ['is_deletable'] =true;
        
                    if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
                        $tempTree ['icon'] = "/images/documents/extension/bz2.png";
                    }*/
        //$tempTree ['leaf'] = true;
        //$tempTree ['optionType'] = "category";
        //$tempTree['allowDrop']=false;
        //$tempTree ['singleClickExpand'] = false;
        /*
        if ($key != "No Category") {
            $tempTree ['expanded'] = true;
        } else {
            //$tempTree ['expanded'] = false;
            $tempTree ['expanded'] = true;
        }
        */
        /*$processListTree [] = $tempTree;
              $tempTree=array();
          }*/
    } else {
        if ($_POST['node'] == '/') {
            //$tempTree=array();
            //$processListTree [] = array();
        }
    }
    if (isset($folderContent)) {
        foreach ($folderContent as $key => $obj) {
            $tempTree['text'] = $obj['APP_DOC_FILENAME'];
            $tempTree['name'] = $obj['APP_DOC_FILENAME'];
            $mimeInformation = getMime($obj['APP_DOC_FILENAME']);
            $tempTree['type'] = $mimeInformation['description'];
            $tempTree['icon'] = $mimeInformation['icon'];
            if (isset($obj['OUT_DOC_GENERATE'])) {
                if ($obj['OUT_DOC_GENERATE'] == "BOTH") {
                    $arrayType = array("PDF", "DOC");
                } else {
                    $arrayType = array($obj['OUT_DOC_GENERATE']);
                }
                foreach ($arrayType as $keyType => $fileType) {
                    $tempTree['text' . $fileType] = $obj['APP_DOC_FILENAME'] . "." . strtolower($fileType);
                    $tempTree['name' . $fileType] = $obj['APP_DOC_FILENAME'] . "." . strtolower($fileType);
                    $mimeInformation = getMime($obj['APP_DOC_FILENAME'] . "." . strtolower($fileType));
                    $tempTree['type' . $fileType] = $mimeInformation['description'];
                    $tempTree['icon' . $fileType] = $mimeInformation['icon'];
                }
            }
            $tempTree['appdocid'] = $obj['APP_DOC_UID'];
            $tempTree['id'] = $obj['APP_DOC_UID_VERSION'];
            $tempTree['cls'] = 'file';
            //$tempTree ['draggable'] = true;
            $tempTree['leaf'] = true;
            $tempTree['is_file'] = true;
            //if ((isset($_POST['option']))&&($_POST['option']=="gridDocuments")) {
            //}
            $tempTree['docVersion'] = $obj['DOC_VERSION'];
            $tempTree['appUid'] = $obj['APP_UID'];
            $tempTree['usrUid'] = $obj['USR_UID'];
            $tempTree['appDocType'] = ucfirst(strtolower($obj['APP_DOC_TYPE']));
            $tempTree['appDocCreateDate'] = $obj['APP_DOC_CREATE_DATE'];
            $tempTree['appDocPlugin'] = $obj['APP_DOC_PLUGIN'];
            $tempTree['appDocTags'] = $obj['APP_DOC_TAGS'];
            $tempTree['appDocTitle'] = $obj['APP_DOC_TITLE'];
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:67,代码来源:appFolderAjax.php

示例12: inlineAdd

 public function inlineAdd($path)
 {
     if (!is_file($path) || !is_readable($path)) {
         $this->errMsg('invalidFile', $path);
         return false;
     }
     $filename = basename($path);
     $this->attachmentName[] = $filename;
     $this->attachmentType[] = getMime($path);
     $this->attachmentPath[] = $path;
     $this->attachSize += filesize($path);
     $this->attachDispos[] = "inline";
     if ($this->attachSize >= max(sizeFromString(ini_get("memory_limit")), 4 * 1048576)) {
         $this->memoryLimit = true;
     }
 }
开发者ID:point,项目名称:cassea,代码行数:16,代码来源:MailObject.php

示例13: array

             $json = array();
         }
         $groups = array();
         $error = false;
         $ts3 = TeamSpeak3::factory("serverquery://" . QUERYUSER . ":" . QUERYPASS . "@" . IP . ":" . QUERYPORT . "/?server_port=" . SERVERPORT . "&nickname=" . urlencode('Icon Sync'));
         foreach ($ts3->serverGroupList() as $sg) {
             if ($sg['iconid']) {
                 try {
                     $groups[$sg['sgid']] = $sg->iconDownload();
                 } catch (TeamSpeak3_Exception $e) {
                 }
             }
         }
         foreach ($groups as $sgid => $binary) {
             if (!empty($binary)) {
                 $type = getMime($binary);
                 if ($type != 'application/octet-stream') {
                     file_put_contents('icons/' . $sgid . '.' . $type, $binary);
                     $json[$sgid] = 'icons/' . $sgid . '.' . $type;
                 }
             }
         }
         file_put_contents('config/icons.json', json_encode($json));
     } catch (Exception $e) {
         echo json_encode(FALSE);
         $error = true;
     }
     if (!$error) {
         echo json_encode(TRUE);
     }
 } else {
开发者ID:Multivit4min,项目名称:GroupAssigner,代码行数:31,代码来源:api.php

示例14: getMime

 public function getMime($file = null)
 {
     return getMime($file);
 }
开发者ID:oriolet,项目名称:bootils,代码行数:4,代码来源:Core.php

示例15: getMime

    }
    return '';
}
function getMime($ext)
{
    include 'boot/mime_types.php';
    if (!array_key_exists($ext, $mimeTypes)) {
        $mime = 'application/octet-stream';
    } else {
        $mime = $mimeTypes[$ext];
    }
    return $mime;
}
$url = str_replace('/public', '', query_path());
$ext = getExt($url);
$mime = getMime($ext);
function getFile($url)
{
    $hostDir = BuCore::fstab('staticHostDir') . '/' . HTTP_HOST;
    $prjDir = BuCore::fstab('staticPrj');
    $coreDir = BuCore::fstab('staticCore');
    foreach (array($hostDir, $prjDir, $coreDir) as $v) {
        if (file_exists($v . $url)) {
            return $v . $url;
        }
    }
}
$file = getFile($url);
if ($file) {
    $fp = fopen($file, 'rb');
    header("Content-Type: " . $mime);
开发者ID:najomi,项目名称:najomi.org,代码行数:31,代码来源:file_loader.php


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