PHP';s getimagesize()投掷";SSL:找不到指定的过程“;


PHP's getimagesize() throwing "SSL: The specified procedure could not be found"

我在测试的图像链接中使用php的getimagesize得到了以下错误消息。。。

getimagesize():SSL:找不到指定的过程。

下面是一个抛出错误的例子(在我的本地/MAMP服务器和实时版本上)。。。

getimagesize("https://cdn.meme.am/instances/500x/65858681.jpg");

有人知道如何进一步挖掘这一点吗?真的不知道该怎么办,也找不到很多类似的问题。谢谢

此代码将为您的

 <?php
function getimgsize($url, $referer = '')
{
    $headers = array(
                    'Range: bytes=0-32768'
                    );
    /* Hint: you could extract the referer from the url */
    if (!empty($referer)) array_push($headers, 'Referer: '.$referer);
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($curl);
    curl_close($curl);
    $image = imagecreatefromstring($data);
    $return = array(imagesx($image), imagesy($image));
    imagedestroy($image);
    return $return;
}
list($width, $heigth) = getimgsize('https://cdn.meme.am/instances/500x/65858681.jpg', 'https://cdn.meme.am/instances/');
echo $width.' x '.$heigth;
?>