跳过已存在图片处理规则

后面可以考虑将分隔符和规则分开处理
pull/6/head
sy-records 2021-09-19 13:57:53 +08:00
parent a2725b1f67
commit 5d7939dbb7
No known key found for this signature in database
GPG Key ID: C3BB4FF13CD72ACE
1 changed files with 2 additions and 2 deletions

View File

@ -404,7 +404,7 @@ function oss_setting_content_style($content)
if (!empty($images) && isset($images[1])) {
$images[1] = array_unique($images[1]);
foreach ($images[1] as $item) {
if(strpos($item, $option['upload_url_path']) !== false){
if((strpos($item, $option['upload_url_path']) !== false) && (strpos($item, $option['style']) === false)){
$content = str_replace($item, $item . $option['style'], $content);
}
}
@ -422,7 +422,7 @@ function oss_setting_post_thumbnail_style( $html, $post_id, $post_image_id )
if (!empty($images) && isset($images[1])) {
$images[1] = array_unique($images[1]);
foreach ($images[1] as $item) {
if(strpos($item, $option['upload_url_path']) !== false){
if((strpos($item, $option['upload_url_path']) !== false) && (strpos($item, $option['style']) === false)){
$html = str_replace($item, $item . $option['style'], $html);
}
}