Improve wish image and favicon generation
This commit is contained in:
parent
29e37afa71
commit
c34b9bd0aa
2 changed files with 5 additions and 5 deletions
|
@ -35,7 +35,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
if (isset($info->url) && $info->url) {
|
||||
$code = URL::getResponseCode($info->url);
|
||||
|
||||
if (200 !== $code) {
|
||||
if ($code < 200 || $code >= 400) {
|
||||
$info->url = $url;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
if (!empty($info->image)) {
|
||||
$codeImage = URL::getResponseCode($info->image);
|
||||
|
||||
if (200 === $codeImage) {
|
||||
if ($codeImage >= 200 && $codeImage < 400) {
|
||||
$wish_image = '"' . $info->image . '"';
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
if (!empty($info->image)) {
|
||||
$codeImage = URL::getResponseCode($info->image);
|
||||
|
||||
if (200 === $codeImage) {
|
||||
if ($codeImage >= 200 && $codeImage < 400) {
|
||||
$wish_image = '"' . $info->image . '"';
|
||||
}
|
||||
}
|
||||
|
|
4
src/classes/cache/embed.php
vendored
4
src/classes/cache/embed.php
vendored
|
@ -101,13 +101,13 @@ class Embed extends Cache
|
|||
|
||||
curl_close($ch);
|
||||
|
||||
$info->favicon = $favicon && 200 === $code ? 'data:image/x-icon;base64,' . base64_encode($favicon) : '';
|
||||
$info->favicon = $favicon && ($code >= 200 && $code < 400) ? 'data:image/x-icon;base64,' . base64_encode($favicon) : '';
|
||||
}
|
||||
|
||||
/** URL */
|
||||
$codeURL = \wishthis\URL::getResponseCode($info->url);
|
||||
|
||||
if (200 !== $codeURL) {
|
||||
if ($codeURL < 200 || $codeURL >= 400) {
|
||||
$generateCache = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue