mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-02-09 13:24:37 +00:00
add image.data field
This commit is contained in:
parent
9c24eda833
commit
68581960a3
Binary file not shown.
@ -149,7 +149,8 @@ class MySQL {
|
|||||||
int $timeAdded,
|
int $timeAdded,
|
||||||
mixed $timeUpdated = null,
|
mixed $timeUpdated = null,
|
||||||
mixed $httpCode = null,
|
mixed $httpCode = null,
|
||||||
mixed $rank = null) {
|
mixed $rank = null,
|
||||||
|
mixed $data = null) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('INSERT INTO `hostImage` ( `hostId`,
|
$query = $this->_db->prepare('INSERT INTO `hostImage` ( `hostId`,
|
||||||
`crc32uri`,
|
`crc32uri`,
|
||||||
@ -157,9 +158,10 @@ class MySQL {
|
|||||||
`timeAdded`,
|
`timeAdded`,
|
||||||
`timeUpdated`,
|
`timeUpdated`,
|
||||||
`httpCode`,
|
`httpCode`,
|
||||||
`rank`) VALUES (?, ?, ?, ?, ?, ?, ?)');
|
`rank`,
|
||||||
|
`data`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
|
||||||
|
|
||||||
$query->execute([$hostId, $crc32uri, $uri, $timeAdded, $timeUpdated, $httpCode, $rank]);
|
$query->execute([$hostId, $crc32uri, $uri, $timeAdded, $timeUpdated, $httpCode, $rank, $data]);
|
||||||
|
|
||||||
return $this->_db->lastInsertId();
|
return $this->_db->lastInsertId();
|
||||||
}
|
}
|
||||||
@ -358,6 +360,7 @@ class MySQL {
|
|||||||
public function getFoundHostImage(int $hostImageId) {
|
public function getFoundHostImage(int $hostImageId) {
|
||||||
|
|
||||||
$query = $this->_db->prepare('SELECT `hostImage`.`uri`,
|
$query = $this->_db->prepare('SELECT `hostImage`.`uri`,
|
||||||
|
`hostImage`.`data`,
|
||||||
`hostImage`.`rank`,
|
`hostImage`.`rank`,
|
||||||
`host`.`scheme`,
|
`host`.`scheme`,
|
||||||
`host`.`name`,
|
`host`.`name`,
|
||||||
|
@ -320,17 +320,24 @@ if (!empty($q)) {
|
|||||||
($hostImage->port ? ':' . $hostImage->port : false) .
|
($hostImage->port ? ':' . $hostImage->port : false) .
|
||||||
$hostImage->uri;
|
$hostImage->uri;
|
||||||
|
|
||||||
// Get remote image data
|
// Get image data
|
||||||
$hostImageCurl = new Curl($hostImageURL);
|
if (empty($hostImage->data)) {
|
||||||
|
|
||||||
// Skip item render on timeout
|
$hostImageCurl = new Curl($hostImageURL);
|
||||||
if (200 != $hostImageCurl->getCode()) continue;
|
|
||||||
|
|
||||||
// Convert remote image data to base64 string to prevent direct URL call
|
// Skip item render on timeout
|
||||||
if (!$hostImageType = @pathinfo($hostImageURL, PATHINFO_EXTENSION)) continue;
|
if (200 != $hostImageCurl->getCode()) continue;
|
||||||
if (!$hostImageBase64 = @base64_encode($hostImageCurl->getContent())) continue;
|
|
||||||
|
|
||||||
$hostImageURLencoded = 'data:image/' . $hostImageType . ';base64,' . $hostImageBase64;
|
// Convert remote image data to base64 string to prevent direct URL call
|
||||||
|
if (!$hostImageType = @pathinfo($hostImageURL, PATHINFO_EXTENSION)) continue;
|
||||||
|
if (!$hostImageBase64 = @base64_encode($hostImageCurl->getContent())) continue;
|
||||||
|
|
||||||
|
$hostImageURLencoded = 'data:image/' . $hostImageType . ';base64,' . $hostImageBase64;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$hostImageURLencoded = $hostImage->data;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div>
|
<div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user