Previously wrote an article on how to read the image under the specified drive letter, although the function can be implemented, but the use of the I/O flow, the efficiency is not high. Now there is a better way to use and more convenient.
We know that when our images are placed under Tomcat under WebApps's app directory, using src= "127.0.1:8080/xx/123.png" This way you can access the images. So if we can use the specified folder as a Tomcat workspace, then we can access the image directly.
All we need to do is add in Tomcat's Conf->server.xml host:
<context path= "/img" docbase= "H:/kk" debug= "0" reloadable= "false" crosscontext= "false" verbosity= " DEBUG > </Context>
Where path is the virtual path, Docbase is the specified folder.
We put 123.png images in the H:/KK, we can access our images in the browser input 127.0.0.1:8080/img/123.png.
Java Web Implementation reads the image under the specified drive letter (ii)