上传图片更名后保存到指定文件夹,想直接在浏览器中动态显示,不需要一个个修改图片地址。
PHP中文网2017-04-17 16:23:55
I don’t know how the uploading front-end part is processed. If you are using HTML5 native, you should be able to use FileReader to convert the image to base64 when uploading, and then fill it in the src of the img tag for display, or use canvas to process it (mainly Compressed), and then output base64 for display. I personally recommend the latter, because if the image is large, there will be performance problems when converting to base64~
I got downvoted inexplicably... If you want to display it in the browser, whether it is the front or backend of the website, there must be front-end participation~ It is recommended to add the upload method.