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


PHP path::info方法代码示例

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


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

示例1: ContentFirstImageLookup

 private static function ContentFirstImageLookup($root, $img, $size)
 {
     # Get base name and extension
     $info = path::info($img);
     $base = $info['base'];
     if (preg_match('/^\\.(.+)_(sq|t|s|m)$/', $base, $m)) {
         $base = $m[1];
     }
     $res = false;
     if ($size != 'o' && file_exists($root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.jpg')) {
         $res = '.' . $base . '_' . $size . '.jpg';
     } else {
         $f = $root . '/' . $info['dirname'] . '/' . $base;
         if (file_exists($f . '.' . $info['extension'])) {
             $res = $base . '.' . $info['extension'];
         } elseif (file_exists($f . '.jpg')) {
             $res = $base . '.jpg';
         } elseif (file_exists($f . '.png')) {
             $res = $base . '.png';
         } elseif (file_exists($f . '.gif')) {
             $res = $base . '.gif';
         }
     }
     if ($res) {
         return $res;
     }
     return false;
 }
开发者ID:HackerMajor,项目名称:root,代码行数:28,代码来源:lib.tpl.context.php

示例2: __construct

 /**
  * Constructor
  *
  * Creates an instance of fileItem object.
  *
  * @param string	$file		Absolute file or directory path
  * @param string	$root		File root path
  * @param string	$root_url		File root URL
  */
 public function __construct($file, $root, $root_url = '')
 {
     $file = path::real($file);
     $stat = stat($file);
     $path = path::info($file);
     $rel = preg_replace('/^' . preg_quote($root, '/') . '\\/?/', '', $file);
     $this->file = $file;
     $this->basename = $path['basename'];
     $this->dir = $path['dirname'];
     $this->relname = $rel;
     $this->file_url = str_replace('%2F', '/', rawurlencode($rel));
     $this->file_url = $root_url . $this->file_url;
     $this->dir_url = dirname($this->file_url);
     $this->extension = $path['extension'];
     $this->mtime = $stat[9];
     $this->size = $stat[7];
     $this->mode = $stat[2];
     $this->uid = $stat[4];
     $this->gid = $stat[5];
     $this->w = is_writable($file);
     $this->d = is_dir($file);
     $this->f = is_file($file);
     $this->x = file_exists($file . '/.');
     $this->del = files::isDeletable($file);
     $this->type = $this->d ? null : files::getMimeType($file);
     $this->type_prefix = preg_replace('/^(.+?)\\/.+$/', '$1', $this->type);
 }
开发者ID:HackerMajor,项目名称:root,代码行数:36,代码来源:class.filemanager.php

示例3: ContentFirstImageLookup

 private static function ContentFirstImageLookup($root, $img, $size)
 {
     global $core;
     # Get base name and extension
     $info = path::info($img);
     $base = $info['base'];
     try {
         $media = new dcMedia($core);
         $sizes = implode('|', array_keys($media->thumb_sizes));
         if (preg_match('/^\\.(.+)_(' . $sizes . ')$/', $base, $m)) {
             $base = $m[1];
         }
         $res = false;
         if ($size != 'o' && file_exists($root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.jpg')) {
             $res = '.' . $base . '_' . $size . '.jpg';
         } elseif ($size != 'o' && file_exists($root . '/' . $info['dirname'] . '/.' . $base . '_' . $size . '.png')) {
             $res = '.' . $base . '_' . $size . '.png';
         } else {
             $f = $root . '/' . $info['dirname'] . '/' . $base;
             if (file_exists($f . '.' . $info['extension'])) {
                 $res = $base . '.' . $info['extension'];
             } elseif (file_exists($f . '.jpg')) {
                 $res = $base . '.jpg';
             } elseif (file_exists($f . '.jpeg')) {
                 $res = $base . '.jpeg';
             } elseif (file_exists($f . '.png')) {
                 $res = $base . '.png';
             } elseif (file_exists($f . '.gif')) {
                 $res = $base . '.gif';
             } elseif (file_exists($f . '.JPG')) {
                 $res = $base . '.JPG';
             } elseif (file_exists($f . '.JPEG')) {
                 $res = $base . '.JPEG';
             } elseif (file_exists($f . '.PNG')) {
                 $res = $base . '.PNG';
             } elseif (file_exists($f . '.GIF')) {
                 $res = $base . '.GIF';
             }
         }
     } catch (Exception $e) {
         $core->error->add($e->getMessage());
     }
     if ($res) {
         return $res;
     }
     return false;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:47,代码来源:lib.tpl.context.php

示例4: imageThumbRemove

 protected function imageThumbRemove($f)
 {
     $p = path::info($f);
     $thumb = sprintf($this->thumb_tp, '', $p['base'], '%s');
     foreach ($this->thumb_sizes as $suffix => $s) {
         try {
             parent::removeFile(sprintf($thumb, $suffix));
         } catch (Exception $e) {
         }
     }
 }
开发者ID:HackerMajor,项目名称:root,代码行数:11,代码来源:class.dc.media.php

示例5: time

        echo '<p><img src="' . $file->media_thumb[$thumb_size] . '?' . time() * rand() . '" alt="" /></p>';
    } elseif ($thumb_size == 'o') {
        $S = getimagesize($file->file);
        $class = $S[1] > 500 ? ' class="overheight"' : '';
        unset($S);
        echo '<p id="media-original-image"' . $class . '><img src="' . $file->file_url . '?' . time() * rand() . '" alt="" /></p>';
    }
    echo '<p>' . __('Available sizes:') . ' ';
    foreach (array_reverse($file->media_thumb) as $s => $v) {
        $strong_link = $s == $thumb_size ? '<strong>%s</strong>' : '%s';
        printf($strong_link, '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("size" => $s, 'tab' => 'media-details-tab'))) . '">' . $core->media->thumb_sizes[$s][2] . '</a> | ');
    }
    echo '<a href="' . $core->adminurl->get('admin.media.item', array_merge($page_url_params, array("size" => "o", "tab" => "media-details-tab"))) . '">' . __('original') . '</a>';
    echo '</p>';
    if ($thumb_size != 'o' && isset($file->media_thumb[$thumb_size])) {
        $p = path::info($file->file);
        $alpha = $p['extension'] == 'png' || $p['extension'] == 'PNG';
        $thumb = sprintf($alpha ? $core->media->thumb_tp_alpha : $core->media->thumb_tp, $p['dirname'], $p['base'], '%s');
        $thumb_file = sprintf($thumb, $thumb_size);
        $T = getimagesize($thumb_file);
        $stats = stat($thumb_file);
        echo '<h3>' . __('Thumbnail details') . '</h3>' . '<ul>' . '<li><strong>' . __('Image width:') . '</strong> ' . $T[0] . ' px</li>' . '<li><strong>' . __('Image height:') . '</strong> ' . $T[1] . ' px</li>' . '<li><strong>' . __('File size:') . '</strong> ' . files::size($stats[7]) . '</li>' . '<li><strong>' . __('File URL:') . '</strong> <a href="' . $file->media_thumb[$thumb_size] . '">' . $file->media_thumb[$thumb_size] . '</a></li>' . '</ul>';
    }
}
// Show player if relevant
if ($file_type[0] == 'audio') {
    echo dcMedia::audioPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_mp3.swf')), null, $core->blog->settings->system->media_flash_fallback);
}
if ($file_type[0] == 'video') {
    echo dcMedia::videoPlayer($file->type, $file->file_url, $core->adminurl->get("admin.home", array('pf' => 'player_flv.swf')), null, $core->blog->settings->system->media_flash_fallback);
}
开发者ID:nikrou,项目名称:dotclear,代码行数:31,代码来源:media_item.php

示例6: imageThumbRemove

 public function imageThumbRemove($f)
 {
     $p = path::info($f);
     $alpha = $p['extension'] == 'png' || $p['extension'] == 'PNG';
     $thumb = sprintf($alpha ? $this->thumb_tp_alpha : $this->thumb_tp, '', $p['base'], '%s');
     foreach ($this->thumb_sizes as $suffix => $s) {
         try {
             parent::removeFile(sprintf($thumb, $suffix));
         } catch (Exception $e) {
         }
     }
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:12,代码来源:class.dc.media.php


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