Image saving to database stops working in version 5.2.4.37


#1

This problem is happening in code that has not been modified. The problem only occurs on version 5.2.4.37. When we use commandbox to specify any other previous lucee version, the code runs fine.

We are copying an image, watermarking and resizing it, then converting it to a png file, and saving it to a SQL Server database. The database column is a varbinary(max)

Code to create image (passGenerated is a cfimage variable):

  local.passThumbnail=ImageNew(arguments.args.passGenerated);
  // Add a "watermark"
  local.width=ImageGetWidth(local.passThumbnail);
  local.height=ImageGetHeight(local.passThumbnail);
  ImageSetDrawingColor(local.passThumbnail,"C6C6C6");
  ImageDrawLine(local.passThumbnail,0,0,local.width,local.height);
  ImageDrawLine(local.passThumbnail,0,local.height,local.width,0);
  ImageResize(local.passThumbnail,"20%","","highperformance");
  local.ppArgs.passThumbnail = local.passThumbnail.getImageBytes('png'); 

Code that is saving it to the database:

local.qInsert = queryExecute(
   " insert into pass_print_log
     (requestID,passThumbnail,logid)
    values
     (:requestID,:passThumbnail,:logID)",
   {
    requestID: {value: arguments.requestStruct.requestID, CFSQLType: 'CF_SQL_INTEGER'},
    passThumbnail: {value: arguments.requestStruct.passThumbnail, CFSQLType: 'CF_SQL_BLOB'},
    logID: {value: arguments.requestStruct.logID, CFSQLType: 'CF_SQL_BIGINT'}
   },
   {
    datasource: instance.gmsbox.name,
    result: "qResult"
   }
  );

Am I missing something basic, or has something changed in 5.2.4.37 that breaks it?

[edit] I should specify that the error happens during the database call.

Can't cast String [Illegal character padding in sequence to be decoded: [0, =, =, =]] to a value of type [binary] Java type of the object is java.lang.String

#2

Hi @Cam_Penner,

I’ve tested above code & Issue happened on 5.2.4.37 version. The issue occurs while we convert image to png file & saved it to SQL database with varbinary(max) type. So please rise a ticket for this issue on Jira (https://luceeserver.atlassian.net/).


#3

https://luceeserver.atlassian.net/browse/LDEV-1576

Thanks.