diff options
author | polo <ordipolo@gmx.fr> | 2022-08-03 02:15:04 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2022-08-03 02:15:04 +0200 |
commit | e4a74650a36bbb72285d38d96ee2a0689031521e (patch) | |
tree | fb08e0c3f1b72f3372598ce1ad535d382f6f5fc7 /model | |
parent | 498ffeb0d502bbf1dbe70f0ae7a81c11b78af37d (diff) | |
download | melaine-e4a74650a36bbb72285d38d96ee2a0689031521e.zip |
captcha + améliorations regex + erreur 404
Diffstat (limited to 'model')
-rw-r--r-- | model/Article.php | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/model/Article.php b/model/Article.php index 24480ed..d0fb019 100644 --- a/model/Article.php +++ b/model/Article.php | |||
@@ -50,13 +50,12 @@ class Article | |||
50 | 50 | ||
51 | private function makeHtmlMiniImages($content) | 51 | private function makeHtmlMiniImages($content) |
52 | { | 52 | { |
53 | while(preg_match('#<img src=.+/images/.+>#', $content)) | 53 | // insérer -mini au nom du dossier et au fichier |
54 | { | 54 | // on choisit pour bien faire de cibler toute la balise <img/> |
55 | // ? => mode paresseux, on fait matcher le moins d'occurences possibles | 55 | $pattern = array('#(<img[^>]+/images(?!-mini))([^>]+>)#', |
56 | $pattern = '#(<img src=.+/)(images)(/.+?)(\.jpg|\.jpeg|\.png|\.gif.+>)#'; | 56 | '#(<img[^>]+)((?<!-mini)(\.jpg|\.jpeg|\.png|\.gif)[^>]+>)#'); |
57 | // insérer -mini au nom du dossier et au fichier | 57 | $remplacement = array('$1-mini$2', '$1-mini$2'); |
58 | $content = preg_replace($pattern, '$1$2-mini$3-mini$4', $content); | 58 | $content = preg_replace($pattern, $remplacement, $content); |
59 | } | ||
60 | 59 | ||
61 | return $content; | 60 | return $content; |
62 | } | 61 | } |