PHP's getimagesize() throwing "SSL: The specified procedure could not be found" -
i'm getting following error message using php's getimagesize on small percentage (<5%) of image links tested...
getimagesize(): ssl: specified procedure not found.
here's example that's throwing error (on both local/mamp server , live version)...
getimagesize("https://cdn.meme.am/instances/500x/65858681.jpg");
anyone have ideas how dig further? don't know go , couldn't find many similar questions. thanks!
this code trick
<?php function getimgsize($url, $referer = '') { $headers = array( 'range: bytes=0-32768' ); /* hint: extract referer 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; ?>
Comments
Post a Comment