问题
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.
回答1:
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);
回答2:
Updating OpenSSL may solve your problem.
Judging from the OpenSSL version you report you have on server this problem may be caused by the server having a newer version of SSL than your client.
The Facebook server is probably using a version >= 1.0.0 or a custom SSL library, while you are using an old 0.9.8.
Heartbeat overflow issue forced many webservers to update their OpenSSL version.
A random article about OpenSSL 1.0.0 handshake issues with clients using 0.9.8 version:
https://groups.google.com/forum/#!topic/msysgit/jSOTOQXPnwU
来源:https://stackoverflow.com/questions/23193870/php-function-getimagesize-gives-read-error-when-trying-to-get-https-url