在PHP imagepng中禁用SSL

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, e.g.

$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);