For example, after the user uploads the avatar, the image address is stored in the database. Is the address string similar to WEB-INF / image / a.jpg?
Keep it simple
Directly transfer the file obtained from the form to the specified directory of the server, record the path to the database, and use nginx and other servers to preview the image directly or use Tomcat and other mapping directory when it needs to be displayed
Use Alibaba’s OSS or seven cattle cloud and other image services to store and push, record the address, and then splice the address for display
1. It is recommended that the image address only store the image name, and the path can be specified when it is used, so as to facilitate the migration of image resources.
2. The access path of the uploaded image is generally
/resources/static/images, which can be accessed through