Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Made. Making a snippet:
<?php
// Вызов
preg_match_all(
'/<img[^>]+src="?\'?([^"\']+)"?\'?[^>]*>/i',
$content,
$matches
);
if (!empty($matches[0]))
{
foreach ($matches[0] as $key => $tag) {
$link = preg_match_all('/<img[^>]+src="?\'?([^"\']+)"?\'?[^>]*>/i', $tag, $matches2, PREG_SET_ORDER);
$new_link = $modx->runSnippet('phpthumbon', array('input' => $matches2[0][1], 'options' => 'w=200&h=200&fltr[]=wmi|/watermark.png|C|100'));
$new_tag = preg_replace('/src=\"(.*?)\"/',"src='$new_link'", $tag);
$content = str_replace($tag, $new_tag, $content);
}
}
echo $content;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question