Because of the servers here are set up, some outbound requests may be blocked. Generally, you will get an SSL error or a garbled response if this is so. Sadly, it looks like this is what you ran into.
What image manipulating functions do you mean? The error message refers to the file_get_contents function. That’s for loading files and external URLs, not image manipulation.
I already removed the image manipulation functions from my script, but in general I used createimage to convert the images to jpg in order to send an API that I consume.