I am getting an SSL error when I try to call imagepng
in PHP.
Message: imagecreatefrompng(): SSL operation failed with code 1
I know there is a way to disable SSL verification when using get_put_contents()
but can you do this with imagepng
? Thanks.
Not directly, but you should be able to combine file_get_contents
with imagecreatefromstring
, eg
$context = [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
],
];
$url = 'https://www.google.co.uk/images/nav_logo242.png';
$response = file_get_contents($url, false, stream_context_create($context));
$img = imagecreatefromstring($response);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.