mirror of
https://github.com/YGGverse/YGGo.git
synced 2025-01-08 22:07:56 +00:00
switch to native curl library
This commit is contained in:
parent
100d12c6ab
commit
9c24eda833
@ -321,17 +321,14 @@ if (!empty($q)) {
|
|||||||
$hostImage->uri;
|
$hostImage->uri;
|
||||||
|
|
||||||
// Get remote image data
|
// Get remote image data
|
||||||
$hostImageCurl = curl_init($hostImageURL);
|
$hostImageCurl = new Curl($hostImageURL);
|
||||||
curl_setopt($hostImageCurl, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($hostImageCurl, CURLOPT_CONNECTTIMEOUT, 5);
|
|
||||||
$hostImageData = curl_exec($hostImageCurl);
|
|
||||||
|
|
||||||
// Skip item render on timeout
|
// Skip item render on timeout
|
||||||
if (curl_error($hostImageCurl)) continue;
|
if (200 != $hostImageCurl->getCode()) continue;
|
||||||
|
|
||||||
// Convert remote image data to base64 string to prevent direct URL call
|
// Convert remote image data to base64 string to prevent direct URL call
|
||||||
if (!$hostImageType = @pathinfo($hostImageURL, PATHINFO_EXTENSION)) continue;
|
if (!$hostImageType = @pathinfo($hostImageURL, PATHINFO_EXTENSION)) continue;
|
||||||
if (!$hostImageBase64 = @base64_encode($hostImageData)) continue;
|
if (!$hostImageBase64 = @base64_encode($hostImageCurl->getContent())) continue;
|
||||||
|
|
||||||
$hostImageURLencoded = 'data:image/' . $hostImageType . ';base64,' . $hostImageBase64;
|
$hostImageURLencoded = 'data:image/' . $hostImageType . ';base64,' . $hostImageBase64;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user