I am importing badge photos from MSSQL to the vault and saving them in jpegPhoto. That works just fine. The photo data type is blob in the database. The problem comes when I attempt to resize the photo and save the resized smaller photo to the photo attribute. I am using this bit of javascript that was posted 4 years ago by Tobias.

function makeSmaller(image, target_width, target_height) {
var new_image = image.getScaledInstance(target_width, target_height, Image.SCALE_SMOOTH);
var buffered_image = new BufferedImage(new_image.getWidth(null), new_image.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);
buffered_image.getGraphics().drawImage(new_image, 0, 0, null);
return buffered_image;
}

Message: Code(-9131) Error in vnd.nds.stream://QAIDV/SERVICES/IDM/DRVSET/DRIVERSET3/Lenel+Photo/Publisher/pub-etp-
Find-User-Add-Photo#XmlData:163 : Error evaluating XPATH expression 'token-xpath("es:makeSmaller($varJpeg, '90px', '120px')
")' : com.novell.xml.xpath.XPathEvaluationException: TypeError: Cannot find function getScaledInstance in object /9j/4AAQSk
ZJRgABAAEASABIAAD//gAgTEVORUwgT25HdWFyZCBDaHJvbWFrZXk9MSwyNCww (the rest is omitted because no one wants to see it)

Here is the action that calls the script:

<do-set-dest-attr-value direct="true" name="photo">
<arg-dn>
<token-local-variable name="varDN"/>
</arg-dn>
<arg-value type="octet">
<token-xpath expression="es:makeSmaller($varJpeg, '90px', '120px')"/>
</arg-value>
</do-set-dest-attr-value>

I have also tried using an xpath statement modify-attr[@attr-name="jpegPhoto"]/add-value/value/text() instead of the variable $varJpeg. Same error either way.

Are my values for height and width correct?

Thanks as always.