What are the potential pitfalls of using SOAP for transporting images in PHP?

One potential pitfall of using SOAP for transporting images in PHP is that SOAP messages have a size limit, which may cause issues when trying to send large image files. To solve this issue, a common approach is to encode the image as a base64 string before sending it through SOAP.

// Encode the image as base64
$image_data = base64_encode(file_get_contents('image.jpg'));

// Send the base64 encoded image through SOAP
$client = new SoapClient("http://example.com/soap.wsdl");
$response = $client->sendImage($image_data);