Summary: Let's say I draw a white emoticon with a canvas element in the browser. When I create a POST image string to a PHP server from this canvas via js / ajax (using toDataUrl ('image / png')) in Safari, the image created on the server with the PHP functions imagecreatefromstring () and imagepng () is the correct height and width, but it's all white, not a smiley from the canvas in the browser.
I remove "data: image / png; base64" from the line to base64_decoding and save to the image file.
This method works flawlessly in FF and Chrome.
The base64 encoded string that toDataUrl generates in js is checked as the same string that the server receives, so it is not truncated during transmission.
When I load the image string from toDataUrl () into any browser, it displays the inverse image as expected. However, newimage.png created on the server is completely white.
Is there anything else Safari does to encode images to a base64 string that should be taken into account on the server? If so, this should not be too harsh, as any browser can display the correct emoticon from the image line.
Please feel free to let me know if you need more information.
Thank you in advance!
EDIT: Could this be related to how Safari maintains transparency?
source
share