Unresolved
Details
Assignee
Pothys - MitrahSoftPothys - MitrahSoftReporter
Eric PetersonEric PetersonPriority
NewLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Details
Details
Assignee
Pothys - MitrahSoft
Pothys - MitrahSoftReporter
Eric Peterson
Eric PetersonPriority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Created 25 April 2022 at 16:36
Updated 25 March 2025 at 19:55
Calling
toBase64
on a CFML image (created withImageNew
) does not return the same value on the first call as with subsequent calls.Here’s a gist on TryCF showing the issue: https://trycf.com/gist/020405d3210659a68da72999afd40bee/acf2018?theme=monokai
<cfscript> imageIO = createObject( "java", "javax.imageio.ImageIO" ); imageUrl = createObject( "java", "java.net.URL" ).init( "https://www.lucee.org/assets/img/logo.png" ); bufferedImage = imageIO.read( imageUrl ); cfmlImage = imageNew( bufferedImage ); firstBase64 = toBase64( cfmlImage ); secondBase64 = toBase64( cfmlImage ); </cfscript> <div> <h3>`toBase64` non-idempotent example</h3> <p>Calling `toBase64` on an image should return the same string every time.</p> <p>Run this on Adobe 2018 engines to see it working correctly.</p> <p>Run it on Lucee 5 to see it failing.</p> <cfoutput> <h4>Are the two `toBase64` calls the same? #uCase( yesNoFormat( firstBase64 == secondBase64 ) )#</h4> </cfoutput> <cfif firstBase64 NEQ secondBase64> <cfdump var="#firstBase64#" expand="false" label="First toBase64 call" /> <cfdump var="#secondBase64#" expand="false" label="Second toBase64 call" /> </cfif> </div>
For what it is worth, it is the second value that is correct.