This commit is contained in:
2026-03-11 16:46:57 +08:00
parent 6d15506c21
commit a1ea1d7234
+1 -7
View File
@@ -826,15 +826,9 @@ class WordpressSiteService
$pathInfo = pathinfo(parse_url($imageUrl, PHP_URL_PATH));
$extension = strtolower($pathInfo['extension'] ?? 'jpg');
// 确定文件名和 Content-Type(使用原始格式)
// 确定文件名和 Content-Type(使用原始格式,不做webp转换)
$filename = ($pathInfo['filename'] ?? 'image') . '.' . $extension;
$contentType = 'image/' . ($extension === 'jpg' ? 'jpeg' : $extension);
$filename = ($pathInfo['filename'] ?? 'image') . '.webp';
$contentType = 'image/webp';
} else {
$filename = ($pathInfo['filename'] ?? 'image') . '.' . $extension;
$contentType = 'image/' . ($extension === 'jpg' ? 'jpeg' : $extension);
}
$mediaUrl = $domain . '/wp-json/wp/v2/media';