Question

Did not find any solutions to my problem .. so here we go..

I have a SLIM webservice, which supports uploading a report containing one or more base64 encoded images.

All data i receive in my webservice functions are json encoded and therefore i decode everything before handling the data.

I tested my function using Advanced Rest Client, and everything worked well, meaning that the images were created successfully.

After integrating the webservice with my iPhone app i got a problem though. The function createimagefromstring returns: invalid chunk type. Even tried to generate new base64 encoded image data using a website for that purpose, and still gave me the same error. It seems that im only able to use the base64 encoded image data that use in Advanced Rest Client.

Additional info: The image i used with success is a very small image, and thus the base64 string is not big. Tried using another image (slightly biggeR) and that worked too. But bigger images doesnt seem to work.. could there be problems here ?

Desperate for help, as the integration between the iPhone app and the webservice must be done soon :)

Thanks in advance

Was it helpful?

Solution

Digging some more revealed that the imagecreatefromstring was not the source of failure.

Strange Base64 encode/decode problem

seems like the encoding removes the + characters and replaces them with space instead.

Solution to my problem so far is:

str_replace(' ','+',$image);

and then afterwards do the base64_decode.

Should anybody have a better solution, please let me know..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top