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


PHP Thumbnail::getPath方法代码示例

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


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

示例1: actionGenerate

 /**
  * Generates a thumbnail for the specified image path and size, then serves 
  * it to the browser. The next time the same thumbnail is rendered its URL 
  * will point to the generated image instead of this action.
  * @see Thumbnail
  * @param string $path the thumbnail path
  * @param int $size the thumbnail size
  * @throws PageNotFoundException if the image could not be generated
  */
 public function actionGenerate($path, $size)
 {
     $thumbnail = new Thumbnail($path, $size);
     $thumbnail->generate();
     $path = $thumbnail->getPath();
     if ($path === false) {
         throw new PageNotFoundException();
     }
     header('Content-Type: ' . CFileHelper::getMimeType($path));
     readfile($path);
     exit;
 }
开发者ID:Tebro,项目名称:xbmc-video-server,代码行数:21,代码来源:ThumbnailController.php

示例2: toHtml

 public function toHtml()
 {
     $classes = "entry " . ($this->isFolder ? "folder " : "file ") . $this->type;
     $imgClass = "";
     $img = $this->type;
     $smallImg = $this->h5ai->icon($this->type);
     $bigImg = $this->h5ai->icon($this->type, true);
     $hint = "";
     if ($this->isFolder && $this->type !== "folder-parent") {
         $code = $this->h5ai->getHttpCode($this->absHref);
         $classes .= " checkedHttpCode";
         if ($code !== "h5ai") {
             if ($code === 200) {
                 $img = "folder-page";
                 $smallImg = $this->h5ai->icon("folder-page");
                 $bigImg = $this->h5ai->icon("folder-page", true);
             } else {
                 $classes .= " error";
                 $hint = "<span class='hint'> " . $code . " </span>";
             }
         }
     }
     if ($this->h5ai->showThumbs() && in_array($this->type, $this->h5ai->getThumbTypes())) {
         $imgClass = " class='thumb' ";
         $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "square", 16, 16);
         $thumbnail->create();
         $smallImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
         $thumbnail = new Thumbnail($this->h5ai, $this->absHref, "rational", 96, 46);
         $thumbnail->create();
         $bigImg = file_exists($thumbnail->getPath()) ? $thumbnail->getHref() : $thumbnail->getLiveHref();
     }
     $html = "\t<li class='" . $classes . "'>\n";
     $html .= "\t\t<a href='" . $this->absHref . "'>\n";
     $html .= "\t\t\t<span class='icon small'><img " . $imgClass . " src='" . $smallImg . "' alt='" . $img . "' /></span>\n";
     $html .= "\t\t\t<span class='icon big'><img " . $imgClass . " src='" . $bigImg . "' alt='" . $img . "' /></span>\n";
     $html .= "\t\t\t<span class='label'>" . $this->label . $hint . "</span>\n";
     $html .= "\t\t\t<span class='date' data-time='" . $this->date . "000'></span>\n";
     $html .= "\t\t\t<span class='size' data-bytes='" . $this->size . "'>" . $this->size . "</span>\n";
     $html .= "\t\t</a>\n";
     $html .= "\t</li>\n";
     return $html;
 }
开发者ID:ryochin,项目名称:h5ai,代码行数:42,代码来源:Extended.php

示例3: getHttpCodes

    $codes = getHttpCodes($h5ai, $hrefs);
    echo count($codes) === 0 ? "{}" : json_encode($codes);
} else {
    if ($action === "thumb") {
        fail(0, "thumbs are disabled", !$options["showThumbs"]);
        list($srcAbsHref, $width, $height, $mode) = checkKeys(array("href", "width", "height", "mode"));
        require_once "inc/Thumbnail.php";
        require_once "inc/Image.php";
        $srcAbsPath = $h5ai->getDocRoot() . rawurldecode($srcAbsHref);
        if (!Thumbnail::isUsable()) {
            Image::showImage($srcAbsPath);
            exit;
        }
        $thumbnail = new Thumbnail($h5ai, $srcAbsHref, $mode, $width, $height);
        $thumbnail->create(1);
        if (file_exists($thumbnail->getPath())) {
            Image::showImage($thumbnail->getPath());
        } else {
            $image = new Image();
            $image->setSource($srcAbsPath);
            $image->thumb($mode, $width, $height);
            $image->showDest();
        }
    } else {
        if ($action === "tree") {
            list($href) = checkKeys(array("href"));
            require_once "inc/Tree.php";
            $absHref = trim($href);
            $absPath = $h5ai->getAbsPath($absHref);
            $tree = new TreeEntry($h5ai, $absPath, $absHref);
            $tree->loadContent();
开发者ID:niftylettuce,项目名称:h5ai,代码行数:31,代码来源:api.php


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