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


PHP Board::getAssetUrl方法代码示例

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


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

示例1: getThumbnailHTML

 /**
  * Returns an XML valid attachment HTML string that handles missing thumbnail URLs.
  *
  * @param  \App\Board  $board  The board this thumbnail will belong to.
  * @param  int  $maxWidth  Optional. Maximum width constraint. Defaults null.
  * @return string  as HTML
  */
 public function getThumbnailHTML(Board $board, $maxDimension = null)
 {
     $ext = $this->guessExtension();
     $mime = $this->mime;
     $url = media_url("static/img/filetypes/{$ext}.svg", false);
     $spoil = $this->isSpoiler();
     $deleted = $this->isDeleted();
     $md5 = $deleted ? null : $this->hash;
     if ($deleted) {
         $url = $board->getAssetUrl('file_deleted');
     } else {
         if ($spoil) {
             $url = $board->getAssetUrl('file_spoiler');
         } else {
             if ($this->isImageVector()) {
                 $url = $this->getDownloadURL($board);
             } else {
                 if ($this->isAudio() || $this->isImage() || $this->isVideo() || $this->isDocument()) {
                     if ($this->hasThumb()) {
                         $url = $this->getThumbnailURL($board);
                     } else {
                         if ($this->isAudio()) {
                             $url = media_url("static/img/assets/audio.gif", false);
                         }
                     }
                 }
             }
         }
     }
     $classHTML = $this->getThumbnailClasses();
     // Measure dimensions.
     $height = "auto";
     $width = "auto";
     $maxWidth = "none";
     $maxHeight = "none";
     $minWidth = "none";
     $minHeight = "none";
     $oHeight = $this->thumbnail_height;
     $oWidth = $this->thumbnail_width;
     if ($this->has_thumbnail && !$this->isSpoiler() && !$this->isDeleted()) {
         $height = $oHeight . "px";
         $width = $this->thumbnail_width . "px";
         if (is_integer($maxDimension) && ($oWidth > $maxDimension || $oHeight > $maxDimension)) {
             if ($oWidth > $oHeight) {
                 $height = "auto";
                 $width = $maxDimension . "px";
             } else {
                 if ($oWidth < $oHeight) {
                     $height = $maxDimension . "px";
                     $width = "auto";
                 } else {
                     $height = $maxDimension;
                     $width = $maxDimension;
                 }
             }
         }
         $minWidth = $width;
         $minHeight = $height;
     } else {
         $maxWidth = Settings::get('attachmentThumbnailSize') . "px";
         $maxHeight = $maxWidth;
         $width = $maxWidth;
         $height = "auto";
         if (is_integer($maxDimension)) {
             $maxWidth = "{$maxDimension}px";
             $maxHeight = "{$maxDimension}px";
         }
         if ($this->isSpoiler() || $this->isDeleted()) {
             $minHeight = "none";
             $minWidth = "none";
             $width = $maxWidth;
         }
     }
     return "<div class=\"attachment-wrapper\" style=\"height: {$height}; width: {$width};\">" . "<img class=\"attachment-img {$classHTML}\" src=\"{$url}\" data-mime=\"{$mime}\" data-md5=\"{$md5}\" style=\"height: {$height}; width: {$width};\"/>" . "</div>";
 }
开发者ID:tmrwbo,项目名称:infinity-next,代码行数:82,代码来源:FileStorage.php

示例2: getThumbnailHTML

 /**
  * Returns an XML valid attachment HTML string that handles missing thumbnail URLs.
  *
  * @return string as HTML
  */
 public function getThumbnailHTML(Board $board)
 {
     $ext = $this->guessExtension();
     $mime = $this->mime;
     $url = asset("static/img/filetypes/{$ext}.svg");
     $type = "other";
     $html = "";
     $stock = true;
     $spoil = $this->isSpoiler();
     if ($spoil) {
         $url = $board->getAssetUrl('file_spoiler');
     } else {
         if ($this->isVideo()) {
             if ($this->hasThumb()) {
                 $stock = false;
                 $url = $this->getThumbnailURL($board);
                 $type = "video";
             }
         } else {
             if ($this->isAudio()) {
                 $stock = false;
                 $type = "audio";
                 $url = $this->getThumbnailURL($board);
             } else {
                 if ($this->isImage()) {
                     if ($this->hasThumb()) {
                         $stock = false;
                         $url = $this->getThumbnailURL($board);
                         $type = "img";
                     }
                 } else {
                     if ($this->isImageVector()) {
                         $stock = false;
                         $url = $this->getDownloadURL($board);
                         $type = "img";
                     }
                 }
             }
         }
     }
     $classes = [];
     $classes['type'] = "attachment-type-{$type}";
     $classes['ext'] = "attachent-ext-{$ext}";
     $classes['stock'] = $stock ? "thumbnail-stock" : "thumbnail-content";
     $classes['spoil'] = $spoil ? "thumbnail-spoiler" : "thumbnail-not-spoiler";
     $classHTML = implode(" ", $classes);
     return "<div class=\"attachment-wrapper {$classHTML}\"><img class=\"attachment-img {$classHTML}\" src=\"{$url}\" data-mime=\"{$mime}\" /></div>";
 }
开发者ID:JEWSbreaking8chan,项目名称:infinity-next,代码行数:53,代码来源:FileStorage.php

示例3: getThumbnailHTML

 /**
  * Returns an XML valid attachment HTML string that handles missing thumbnail URLs.
  *
  * @return string  as HTML
  */
 public function getThumbnailHTML(Board $board)
 {
     $ext = $this->guessExtension();
     $mime = $this->mime;
     $url = asset("static/img/filetypes/{$ext}.svg");
     $spoil = $this->isSpoiler();
     if ($spoil) {
         $url = $board->getAssetUrl('file_spoiler');
     } else {
         if ($this->isImageVector()) {
             $url = $this->getDownloadURL($board);
         } else {
             if ($this->isAudio() || $this->isImage() || $this->isVideo()) {
                 if ($this->hasThumb()) {
                     $url = $this->getThumbnailURL($board);
                 } else {
                     if ($this->isAudio()) {
                         $url = asset("static/img/assets/audio.gif");
                     }
                 }
             }
         }
     }
     $classHTML = $this->getThumbnailClasses();
     // Measure dimensions.
     $height = "auto";
     $width = "auto";
     if ($this->has_thumbnail) {
         $oHeight = $this->thumbnail_width;
         $oWidth = $this->thumbnailWidth;
         if ($this->thumbnail_width > $this->thumbnail_height) {
             $width = $this->thumbnail_width . "px";
         } else {
             if ($this->thumbnail_width < $this->thumbnail_height) {
                 $height = $this->thumbnail_height . "px";
             }
         }
     } else {
         $oHeight = Settings::get('attachmentThumbnailSize') . "px";
         $oWidth = $oHeight;
         $width = $oHeight;
         $height = $oHeight;
     }
     return "<div class=\"attachment-wrapper\" style=\"height: {$oHeight}; width: {$oWidth};\">" . "<img class=\"attachment-img {$classHTML}\" src=\"{$url}\" data-mime=\"{$mime}\" style=\"height: {$height}; width: {$width};\"/>" . "</div>";
 }
开发者ID:GodOfConquest,项目名称:infinity-next,代码行数:50,代码来源:FileStorage.php


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