Blog 5.1 RSS Check image

This commit is contained in:
fredtempez 2021-05-26 18:16:35 +02:00
parent 8b156674ef
commit 3720e017c6
2 changed files with 19 additions and 17 deletions

View File

@ -15,7 +15,7 @@
class blog extends common { class blog extends common {
const VERSION = '5.0'; const VERSION = '5.1';
const REALNAME = 'Blog'; const REALNAME = 'Blog';
const DELETE = true; const DELETE = true;
const UPDATE = '0.0'; const UPDATE = '0.0';
@ -163,11 +163,13 @@ class blog extends common {
$newsArticle->setAuthor($author,'no@mail.com'); $newsArticle->setAuthor($author,'no@mail.com');
$newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $articleId); $newsArticle->setId(helper::baseUrl() .$this->getUrl(0) . '/' . $articleId);
$newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn']))); $newsArticle->setDate(date('r', $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'publishedOn'])));
if ( file_exists($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'picture'])) ) {
$imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb); $imageData = getimagesize(helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb);
$newsArticle->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb, $newsArticle->addEnclosure( helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb,
$imageData[0] * $imageData[1], $imageData[0] * $imageData[1],
$imageData['mime'] $imageData['mime']
); );
}
$feeds->addItem($newsArticle); $feeds->addItem($newsArticle);
} }
} }

View File

@ -4,8 +4,8 @@
<?php foreach($module::$articles as $articleId => $article): ?> <?php foreach($module::$articles as $articleId => $article): ?>
<div class="row rowArticle"> <div class="row rowArticle">
<div class="col3"> <div class="col3">
<?php <?php if ( file_exists(self::FILE_DIR . 'source/' . $article['picture']) ): ?>
// Déterminer le nom de la miniature <?php // Déterminer le nom de la miniature
$parts = explode('/',$article['picture']); $parts = explode('/',$article['picture']);
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $article['picture']); $thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $article['picture']);
// Créer la miniature si manquante // Créer la miniature si manquante
@ -14,11 +14,11 @@
self::FILE_DIR . 'thumb/' . $thumb, self::FILE_DIR . 'thumb/' . $thumb,
self::THUMBS_WIDTH); self::THUMBS_WIDTH);
} }
?> ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture"> <a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $articleId; ?>" class="blogPicture">
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $article['picture']; ?>"> <img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $article['picture']; ?>">
</a> </a>
<?php endif;?>
</div> </div>
<div class="col9"> <div class="col9">
<h1 class="blogTitle"> <h1 class="blogTitle">