From 9c24eda833a4bddb879d35b6a7c0353124b75190 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 4 May 2023 04:56:25 +0300 Subject: [PATCH] switch to native curl library --- public/search.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/public/search.php b/public/search.php index d8b9a52..835a6ad 100644 --- a/public/search.php +++ b/public/search.php @@ -321,17 +321,14 @@ if (!empty($q)) { $hostImage->uri; // Get remote image data - $hostImageCurl = curl_init($hostImageURL); - curl_setopt($hostImageCurl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($hostImageCurl, CURLOPT_CONNECTTIMEOUT, 5); - $hostImageData = curl_exec($hostImageCurl); + $hostImageCurl = new Curl($hostImageURL); // 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 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;