I am currently running into a problem (and also in the past) where image write locks the image file in windows and thus make it not possible to call fileMove. The test I have now is:
var test_image = imageReadBase64("base64 image");
test_image.write("path", 1, true);
cfimage(source="#test_image#" destination="path" action="write" overwrite="true");
once I have run this code I cannot remove the file in windows (only after 5/10 minutes or longer).
The problem I am having is that I want to move the file after this code to a new path, but it doesn’t let me because I get a “Can’t delete resource” message. Anyone know how to fix this?
Thanks in advance!
Don’t forget to tell us about your stack!
Image extension: 22.214.171.124-SNAPSHOT
OS: Windows Server 2012 R2 (6.3) 64bit
Java Version: 11.0.6 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.31
Lucee Version: Lucee 126.96.36.199
This has been resolved as part of a full rewrite in v2
Thanks for the quick response! I’ve updated the image extension to “188.8.131.52-RC” but the problem is sadly still here, I even did a restart of Lucee. Somehow the write function locks the file and I don’t know why.
I am now thinking of rewriting it with fileCopy (which does work) and then a schedular function that cleans the temp folder, But that’s obviously not how I want it to work, so I hope a solution exists!
hmmmf, can you file a bug in jira?
@DrunkenMoose The above mentioned Image extension version(184.108.40.206-SNAPSHOT) doesn’t exist. So can you check your installed image extension version and report back here?
Try it with the latest stable release first?
There was a bytecode issue that tied code to the extension version it was compiled against which was resolved in 5.3.10
Hmm that’s odd as I am sure I copied it, but you are right I cannot find that version, but I updated it to “220.127.116.11-RC” and the issue still persisted.
Currently I have rewritten it as a fileCopy (so there is no delete in the background) with a schedular task that empties the temp folder every night (I had some haste as it needed to be resolved). But thanks for giving the info, perhaps later I can take another look as why it locks. It has to be the plugin as I did a very simple example containing two lines of code. So perhaps another version will help! Thanks for now.