仅显示第一个打开的图像(检票口)

时间:2018-01-17 13:07:25

标签: java css image wicket wicket-7

我的程序应该通过存储在数据库中的id为用户显示头像(图像)。存储在磁盘上的图像。我使用BufferedDynamicImageResource显示图像,但问题始终显示首先打开的图片。如何解决?

图像阅读:

*for file in /*.1.txt

echo $(basename "$file") | sed 's/.1.txt/.2.txt/' > file2

do command -left "$file" -right "$file2"

done*

函数调用:

public ResourceReference getImage() {
    return new ResourceReference(UserPage.class, "image") {
        private static final long serialVersionUID = 2127616487187967396L;

        @Override
        public IResource getResource() {
            BufferedImage image = null;
            File f = null;

            //read image
            try {
                f = new File("PATH");
                image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
                image = ImageIO.read(new FileImageInputStream(f));
                System.out.println("Reading complete.");
            } catch (IOException e) {
                System.out.println("Error: " + e);
            }
            BufferedDynamicImageResource resource = new BufferedDynamicImageResource();
            resource.setImage(image);
            return resource;
        }
    };
}

我正在使用Wicket 7.8.0

1 个答案:

答案 0 :(得分:2)

我认为您的问题与浏览器中的缓存有关。尝试使用Image代替const uint CREATE_SUSPENDED = 0x00000004; const uint CREATE_NEW_CONSOLE = 0x00000010; [DllImport("kernel32.dll", SetLastError = true)] private static extern Boolean CreateProcess(String lpApplicationName, String lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, Boolean bInheritHandles, UInt32 dwCreationFlags, IntPtr lpEnvironment, String lpCurrentDirectory, Byte[] lpStartupInfo, out PROCESS_INFORMATION lpProcessInfo); public static MyCreateProcess(path, QuotedPath) { CreateProcess(path, QuotedPath, IntPtr.Zero, IntPtr.Zero, false, CREATE_SUSPENDED | CREATE_NEW_CONSOLE , IntPtr.Zero, null, ref SI, ref PI); } 组件。