mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
meta image for blog post covers
This commit is contained in:
parent
8f8948c6ce
commit
cbccfa6e74
2 changed files with 17 additions and 3 deletions
|
@ -244,9 +244,23 @@ class Post
|
||||||
|
|
||||||
public function getImageUrls()
|
public function getImageUrls()
|
||||||
{
|
{
|
||||||
|
$urls = [];
|
||||||
|
|
||||||
|
$cover = $this->getCover();
|
||||||
|
if ($cover)
|
||||||
|
{
|
||||||
|
$urls[] = 'https://' . $_SERVER['SERVER_NAME'] . '/img/' . $cover;
|
||||||
|
}
|
||||||
|
|
||||||
$matches = [];
|
$matches = [];
|
||||||
preg_match_all('/!\[.*?\]\((.*?)\)/', $this->markdown, $matches);
|
preg_match_all('/!\[.*?\]\((.*?)\)/', $this->markdown, $matches);
|
||||||
return $matches ? $matches[1] : [];
|
|
||||||
|
if ($matches)
|
||||||
|
{
|
||||||
|
$urls = array_merge($urls, $matches[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function markdownToText($markdown)
|
protected function markdownToText($markdown)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="post-content">
|
<section class="post-content">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php echo $post->getContentHtml() ?>
|
<?php echo $post->getContentHtml() ?>
|
||||||
|
@ -30,6 +30,6 @@
|
||||||
<?php if ($post->hasAuthor()): ?>
|
<?php if ($post->hasAuthor()): ?>
|
||||||
<?php echo View::render('content/_postAuthor', ['post' => $post]) ?>
|
<?php echo View::render('content/_postAuthor', ['post' => $post]) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
<?php echo View::render('nav/_footer') ?>
|
<?php echo View::render('nav/_footer') ?>
|
||||||
|
|
Loading…
Add table
Reference in a new issue