git.shiar.nl
/
minimedit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nieuws: alternate cover image for .groot file name
[minimedit.git]
/
nieuws.inc.php
diff --git
a/nieuws.inc.php
b/nieuws.inc.php
index 0e3c877890020c13ab8c7a300c100a05d1fa6471..40432a9c22cfc6aa1411ac866e6cf9e5e577ac9a 100644
(file)
--- a/
nieuws.inc.php
+++ b/
nieuws.inc.php
@@
-78,7
+78,9
@@
class ArchiveArticle
{
$this->title;
$rest = fread($this->file, filesize($this->page));
{
$this->title;
$rest = fread($this->file, filesize($this->page));
- if ( preg_match('{\n<p>(<img [^>]*>)</p>|\n<hr />}', $rest, $img, PREG_OFFSET_CAPTURE) ) {
+ if ( preg_match('{
+ \n (?: < (?: p | figure [^>]* ) >\s* )+ (<img\ [^>]*>) | \n <hr\ />
+ }x', $rest, $img, PREG_OFFSET_CAPTURE) ) {
if (isset($img[1])) {
$this->img = $img[1][0];
}
if (isset($img[1])) {
$this->img = $img[1][0];
}
@@
-111,7
+113,10
@@
class ArchiveArticle
function thumb($size = '300x')
{
if (!$this->image or $this->image[0] !== '/') return;
function thumb($size = '300x')
{
if (!$this->image or $this->image[0] !== '/') return;
- return preg_replace('{^(?:/thumb/[^/]*)?}', "thumb/$size", $this->image);
+ return preg_replace(
+ ['{^(?:/thumb/[^/]*)?}', '/\.groot(?=\.\w+$)/'], ["thumb/$size", ''],
+ $this->image
+ );
}
}
}
}