作者 刘锟

update

... ... @@ -64,7 +64,7 @@ class ThumbProjectImage extends Command
} else {
//所有项目
$projectModel = new Project();
$list = $projectModel->list(['id' => ['>', 893], 'delete_status' => 0, 'is_upgrade' => 0, 'type' => ['in', [1, 2, 3, 4, 6]]], 'id', ['id'], 'asc');
$list = $projectModel->list(['id' => ['>=', 2108], 'delete_status' => 0, 'is_upgrade' => 0, 'type' => ['in', [1, 2, 3, 4, 6]]], 'id', ['id'], 'asc');
foreach ($list as $k => $v) {
$project_id = $v['id'];
... ...
... ... @@ -1491,7 +1491,14 @@ function thumbImageByUrl($url, $width = 360)
}
//获取图片完整访问地址
$url_complete = getImageUrl($url, 0, 0, 0);//先用v6-file地址
if (strpos($url_complete, 'v6-file') !== false) {
$is_exists = checkRemoteFileExists($url_complete);
if (!$is_exists) {
//不存在,再用cdn地址
$url_complete = getImageUrl($url);
}
}
//获取与原图存储路径相同的压缩路径
$path = parse_url($url_complete, PHP_URL_PATH);
... ... @@ -1525,6 +1532,23 @@ function thumbImageByUrl($url, $width = 360)
return $url;
}
function checkRemoteFileExists($url)
{
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_NOBODY, true);
$result = curl_exec($curl);
$found = false;
if ($result !== false) {
$statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($statusCode == 200) {
$found = true;
}
}
curl_close($curl);
return $found;
}
if (!function_exists('httpGetSsl')) {
/**
* 获取通配符证书
... ...