Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP function getimagesize() gives "Read error" when trying to get https url

I am trying to use getimagesize with URL and with http everything is fine. However when trying to use function on https url I am getting "Read error" Notice and false as result. I checked and I have OpenSSL 0.98 installed on the server (so it should be working with https as well). I know that I can download the image first and then use it but it seems to me like this should work and that I am missing something. Could you please provide me with some solution (other than downloading the image first and then opening it) ?

Thank you in advance.

like image 756
Goran Avatar asked Oct 20 '22 09:10

Goran


1 Answers

You can use file_get_contents() as an alternate solution..

<?php
$filename='something';
file_put_contents($filename,file_get_contents($url));
$size = getimagesize($filename);
var_dump($size);
like image 140
Shankar Narayana Damodaran Avatar answered Oct 23 '22 00:10

Shankar Narayana Damodaran