Is there some version combination of Lucee and the...
# lucee
j
Is there some version combination of Lucee and the image extension that works with the `webp`image format? Let's say "works" means: Image functions can read/write webp images. I'm hoping to get webp working in Lucee 5.3 because it's important to use webp in my CMS.
1
Standalone example:
Copy code
<cfscript>
// 2x2 px webp
img = imageReadBase64('data:image/webp;base64,UklGRoIDAABXRUJQVlA4WAoAAAAMAAAAAQAAAQAAVlA4ICIAAABQAQCdASoCAAIAAgA0JQBOgCgAAP7o1xGE0jAYElaswgAARVhJRmgAAABNTQAqAAAACAAEAQYAAwAAAAEAAgAAARIAAwAAAAEAAQAAASgAAwAAAAEAAQAAh2kABAAAAAEAAAA+AAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAAACoAMABAAAAAEAAAACAAAAAFhNUCDKAgAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj4xPC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICAgICA8dGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPjI8L3RpZmY6UGhvdG9tZXRyaWNJbnRlcnByZXRhdGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4Kq');
img.resize(1, 1);
img.write('1x1px.webp');
</cfscript>
z
There is experimental support in 2.0 and 1.0 (1.2 is abandoned)
It's passing the CI tests
I'm seeing some random problems on windows tho
Mainly focused on 2.0 which is in beta
12 monkeys should work
There are read write tests in the imageFormat tests, plus a test suite of sample images
j
is 12 monkeys used by default? i had trouble with all of the extension versions i tried but i can try again if you give me a lucee 5.3.x version and image extension version that are thought to work together.
z
I am only ever interested in the status of the latest snapshot or beta, Currently 2.0.0.18
j
okay, will try with lucee 5.3.9.166 and image 2.0.0.18
unless i'm crazy, i don't think it actually works, despite what the automated tests suggest. wouldn't you expect this to write a file to the current directory?
Copy code
<cfscript>
    img = imageReadBase64('data:image/webp;base64,UklGRoIDAABXRUJQVlA4WAoAAAAMAAAAAQAAAQAAVlA4ICIAAABQAQCdASoCAAIAAgA0JQBOgCgAAP7o1xGE0jAYElaswgAARVhJRmgAAABNTQAqAAAACAAEAQYAAwAAAAEAAgAAARIAAwAAAAEAAQAAASgAAwAAAAEAAQAAh2kABAAAAAEAAAA+AAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAAACoAMABAAAAAEAAAACAAAAAFhNUCDKAgAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8dGlmZjpDb21wcmVzc2lvbj4xPC90aWZmOkNvbXByZXNzaW9uPgogICAgICAgICA8dGlmZjpSZXNvbHV0aW9uVW5pdD4yPC90aWZmOlJlc29sdXRpb25Vbml0PgogICAgICAgICA8dGlmZjpQaG90b21ldHJpY0ludGVycHJldGF0aW9uPjI8L3RpZmY6UGhvdG9tZXRyaWNJbnRlcnByZXRhdGlvbj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjI8L2V4aWY6UGl4ZWxYRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpDb2xvclNwYWNlPjE8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4Kq');
    // img = imageRead('1.sm.webp');
    img.write('1x1px.webp');
</cfscript>
for me, it does nothing, but throws no error.
z
Look at the latest commit, explore from there
j
my takeaway is that `webp`doesn't quite work in any of the versions, if the acceptance criteria are both: • ability to read • ability to write
i bet micha has some secret java test harness for working with the java extension source because the workflow as i understand it doesn't lend itself to straightforward development. it's like you have to guess at all the java, then throw it over the fence to lucee before you know whether your changes are sane. normally, you wouldn't have to wait until integration time to smoke-test your changes to a code base--you'd have some way to smoke test it from within the very same project. this might be part of @Charles Robertson’s problem (though i only skimmed that thread).
i think the barrier to entry for extension development (as i currently understand it) is too high for me to participate, even though i'd like to.
i think i'll just create a bug report for a basic read/write test case and see if it gets picked up.
thanks for your help getting me as far as i got, @zackster
c
You can actually see that we have worked out a way of editing an extension without having to repackage/uninstall/install, each time. You can compare an upload that @zackster made [at the end of our thread] and the finished extension at https://github.com/Leftbower/cfspreadsheet-lucee-5 Essentially, it is about stripping away the parts that are required to make the extension wire up. I must say, from not knowing anything about Lucee extensions at the start of the thread, I feel like an expert, now 😉 Although there is some official documentation about Lucee 5 extensions, it doesn’t really go into, how one goes about editing an extension. I might write a blog about it, when I get some free time. 🙏
j
hmm, time for me to dig into your thread, @Charles Robertson
at a glance, it looks like you were working on the CFML side of things, versus the java side. right, @Charles Robertson?
@zackster, i reported my findings here (https://luceeserver.atlassian.net/browse/LDEV-3961?focusedCommentId=52741) , since it seemed to be the current and appropriate ticket, but let me know if it should be in a new ticket (or elsehwhere).
c
Yes. More on the CFML side of things. But, I am talking more about the way you need to restructure the extension directory, in order to be able to update the code efficiently. There are three settings that need to be set in the
Application.cfc
, to convert the extension into an updateable repo: application.cfc
Copy code
component {

    this.functionpaths = [path_to_extensions_functions_directory];    
    this.customtagpaths = [path_to_extension_tags_directory;
    this.javasettings.bundle = [path_to_extension_jars_directory];

 }
We are not so sure about the
this.javasettings.bundle
setting, but the other two are certainly required.
hmm, time for me to dig into your thread, @Charles Robertson
I hope you have plenty of time, on your hands. There are 150 or so replies! 😂 I went down quite a few rabbit holes! Thankfully @zackster had the patience to stay with me 👏🏻
j
okay, thanks. that's probably useful for the java side of things, too. however, i think some of my issues will remain, regardless, when working on the java, since i think it will get convoluted doing typical java development (like having direct access to step debugging, etc.). i still find it odd to completely rely on lucee as a test harness for a java project (the image extension is pure java--no CFML), with no way to run/test directly. i can understand why the lucee integration tests would be important--most important, even; however, not being able to run the java directly is weird. i still feel like i'm missing some secret that micha probably knows.
if you're working on just the cfml-side of an extension, as with cfspreadsheet, i can see how your strategy would revolutionize that process, since the jar just sits there like a lump that you don't need to iterate on, and it's all about the cfml.
z
Step debugging is totally possible, you just need to configure your ide workspace with the source paths for lucee core, loader and the extension (s) then it works.
Webp is read only unless you have a commercial library
The extension uses utility methods from lucee so it can't be just run in isolation
j
Webp is read only unless you have a commercial library
Thanks, @zackster, that's a huge detail that I missed about TwelveMonkeys. From what I can tell, the following libs support writes: • jdeli ($ option, which has a free trial) https://www.idrsolutions.com/jdeli/ • scrimage (FOSS) https://sksamuel.github.io/scrimage/ • webp-imageio (FOSS, but might be abandoned) https://github.com/sejda-pdf/webp-imageio How would I try jdeli, do you know? I tried adding
jdeli-imageio-trial.jar
to the image extension's
source/java/libs
directory and building/installing the extension. I then added `this.image.coder="JDeli";`to the
Application.cfc
in my test app, but it didn't seem to make a difference.
z
the lib goes in the lucee lib dir, not the source folder
j
thanks, @zackster, I'll try that.
z
do a pull, the non existent file bug has been fixed
👍 1
tho micha is still working on ironing out some other bugs at the moment
j
that got jdeli working, @zackster, thanks. hopefully the webp/java landscape changes soon so that we don't need commercial libraries, but i'm happy to see something working!
z
twelve monkeys want to add write support for webp, they just need some sponsorship https://github.com/haraldk/TwelveMonkeys/issues/659
j
yeah, i saw that thread. more than i can take on, personally, but i'm keeping an eye on it.