The picture does not display normally after Base64.

the front-end react, the back-end springboot, makes a verification code, and the backend generates a picture to be transferred to base64 and then returns to the front end for direct display. Now the problem is running ok, locally, but there is something wrong with the image with the verification code on Aliyun. The picture can be displayed, but the content in the picture is completely unrecognizable.

the base64 content returned locally is directly written to the front end, and then deployed to Ariyun, which can be displayed normally. On the contrary, there is still a problem with the local writing returned on Aliyun. That proves that it is not the front-end display problem, but the back-end generation and the return of this part. Now I have no clue at all.

comparing the two pictures, the one on the left is problematic and completely unrecognizable:

clipboard.png
clipboard.png

base64+

java:
clipboard.png

react parses base64 content directly with data:image/jpeg;base64,+base64 content.

has anyone ever encountered this kind of situation?

Mar.16,2021

if you compare the difference yourself, isn't it possible that the local and Ali CVM may be different in the jre environment?

the key is why you want to transfer to base64?.


has found the problem, because the Aliyun ecs is so clean that it doesn't even have a basic font, so just install the font, which has nothing to do with the code.

Menu