Since the company's EMP imaging platform is quite cumbersome and needs to be downloaded to preview the picture, the business staff proposed to add a preview page to the attachment list page. The process completed will be recorded today:
One is the js version, the other is the jquery version,Here is the js version. The jquery version is just slightly different.
1.Introduce plug-in (uploaded)
<SCRIPT src="styles/ccc/"></SCRIPT>
<SCRIPT src="styles/ccc/"></SCRIPT>
2. Write the preview page alive
<SCRIPT> var attach_path= '${param.attach_path}'; var attach_name= decodeURI('${param.attach_name}'); var attachPath= new Array(); attachName=attach_name.split(","); var attachPath1= new Array(); attachPath1=attach_path.split(","); for (var i=0;i<;i++) { attachPath2='102storage'+attachPath1[i]; $("#jq22").append("<li><img alt='"+attachName[i]+"' src='"+attachPath2+"'></li>"); } $(function() { $('#jq22').viewer({ url: 'data-original', }); }); </SCRIPT>
Pass the path of the picture from the previous list page to the preview page. You can select multiple or non-select images when previewing the picture. If you do not select, you will display all the pictures in this list by default. If you check, you will display the pictures after the checked. Here I found that the APP uploads many compressed images, so the automatic decompression function of *.zip, *.rar is added in the background. This part requires the introduction of third-party jar packages. The 1.6 only supports *.zip format decompression, and the most tricky sun company defaults to the default encoding. If there is Chinese, it will report an error. Only when jdk1.7 is used, it supports Chinese.
import .*;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
3. Asynchronously delete the decompressed file
Considering that the decompression will occupy space on the shared disk, asynchronous deletion will be performed after decompression. The time is 20s, and the time is enough. However, if you click to reload the page after 20s, the image will fail to load because the path of the image has expired.
//Asynchronously delete files (save space) List<Thread> threadList = new ArrayList<Thread>(); Thread thread = new Thread(new DeleteTemporaryFolder(dstDirectoryPath)); (); for(Thread t : threadList){ try { (); } catch (InterruptedException e) { (); } }
4. Disk mount
When displaying pictures, the page cannot access the image path that the project thinks, so you need to execute the mount command to mount the path of the shared disk on a path under the project.
mount --bind /testshare01 /app/cmis/project//ff/testshare01
This will be displayed normally
The above is the entire content of this article. I hope the content of this article will be of some help to everyone’s study or work. If you have any questions, you can leave a message to communicate. Thank you for your support!