本文整理汇总了PHP中app\Board::getSpoilerUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Board::getSpoilerUrl方法的具体用法?PHP Board::getSpoilerUrl怎么用?PHP Board::getSpoilerUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Board
的用法示例。
在下文中一共展示了Board::getSpoilerUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getThumbnailURL
/**
* Supplies a clean thumbnail URL for embedding an attachment on a board.
*
* @param \App\Board $board
* @return string
*/
public function getThumbnailURL(Board $board)
{
$ext = $this->guessExtension();
if ($this->isSpoiler()) {
return $board->getSpoilerUrl();
}
if ($this->isImage() || $this->isDocument()) {
$ext = Settings::get('attachmentThumbnailJpeg') ? "jpg" : "png";
} else {
if ($this->isVideo()) {
$ext = "jpg";
} else {
if ($this->isAudio()) {
if (!$this->hasThumb()) {
return $board->getAudioArtURL();
}
$ext = "png";
} else {
if ($this->isImageVector()) {
// With the SVG filetype, we do not generate a thumbnail, so just serve the actual SVG.
return $this->getDownloadURL($board);
}
}
}
}
$params = ['attachment' => $this->getIdentifier(), 'filename' => $this->getDownloadName() . ".{$ext}"];
if (!env('APP_MEDIA_URL', false)) {
$params['board'] = $board;
}
// "False" generates a relativel URL.
// Attachments get cached, so we want that.
return route('static.thumb.attachment', $params, false);
}
示例2: getThumbnailURL
/**
* Supplies a clean thumbnail URL for embedding an attachment on a board.
*
* @param App\Board $board
* @return string
*/
public function getThumbnailURL(Board $board)
{
$baseURL = "/{$board->board_uri}/file/thumb/{$this->hash}/";
$ext = $this->guessExtension();
if ($this->isSpoiler()) {
return $board->getSpoilerUrl();
}
if ($this->isImage()) {
$ext = Settings::get('attachmentThumbnailJpeg') ? "jpg" : "png";
} else {
if ($this->isVideo()) {
$ext = "jpg";
} else {
if ($this->isAudio()) {
if (!$this->hasThumb()) {
return $board->getAudioArtURL();
}
$ext = "png";
} else {
if ($this->isImageVector()) {
// With the SVG filetype, we do not generate a thumbnail, so just serve the actual SVG.
$baseURL = "/{$board->board_uri}/file/{$this->hash}/";
}
}
}
}
return url("{$baseURL}{$this->getFileName()}.{$ext}");
}
示例3: getThumbnailURL
/**
* Supplies a clean thumbnail URL for embedding an attachment on a board.
*
* @param App\Board $board
* @return string
*/
public function getThumbnailURL(Board $board)
{
$baseURL = "/{$board->board_uri}/file/thumb/{$this->hash}/";
$ext = $this->guessExtension();
if ($this->isSpoiler()) {
return $board->getSpoilerUrl();
}
if ($this->isAudio()) {
if (!$this->hasThumb()) {
return $board->getAudioArtURL();
}
} else {
if ($this->isImageVector()) {
// With the SVG filetype, we do not generate a thumbnail, so just serve the actual SVG.
$baseURL = "/{$board->board_uri}/file/{$this->hash}/";
}
}
// Sometimes we supply a filename when fetching the filestorage as an attachment.
if (isset($this->pivot) && isset($this->pivot->filename)) {
return url($baseURL . urlencode($this->pivot->filename));
}
return url($baseURL . strtotime($this->first_uploaded_at) . "." . $this->guessExtension());
}