Crash app because the string is too long, base64 string

I have an ESP32-CAM Firebase project, and when I send a long string (> 9000 char), the app crashes. However, when I change the string to a short one, the app works fine. Thank you for your help.

You did not show us the code of sending. can you identify which block caused the crashes? the crashes is happening when sending or receiving? or when Base64toImage?

application closed when sending base64 . string
Screenshot 2023-06-11 131816

Maybe firebase have limitation on the length of the value. I am not sure.
Try resize the image to a small size, or try CloudDB?

i found the cause, it was "/9j/" in front, i removed it and the app passed successfully, but base64 needs it to convert to image, so how to add /9j/ in block part

try these blocks

encode before sending, decode after receiving.

thank you so much

You could always use firebase storage instead, then save the URL to the real-time database...