Image 如何从Active Directory检索映像?

Image 如何从Active Directory检索映像?,image,active-directory,base64,salesforce,Image,Active Directory,Base64,Salesforce,我试图从Active Directory中检索thumbnailPhoto属性,将其转换为Base64,然后用它更新Salesforce中的一个字段。但正如您从下图中看到的,找不到该图像: 这是我的密码: output_row.Id = input_row.Id; output_row.UserPhotoLoader__User_Photo_Blob__c = null; File file = new File("C:/Desktop/Studio/workspace/" +

我试图从Active Directory中检索thumbnailPhoto属性,将其转换为Base64,然后用它更新Salesforce中的一个字段。但正如您从下图中看到的,找不到该图像:

这是我的密码:

 output_row.Id = input_row.Id;
 output_row.UserPhotoLoader__User_Photo_Blob__c = null;


 File file = new File("C:/Desktop/Studio/workspace/" + 
 input_row.thumbnailPhoto + ".jpg");


try {           
    FileInputStream imageInFile = new FileInputStream(file);
    byte imageData[] = new byte[(int)file.length()];
    imageInFile.read(imageData);
    imageInFile.close();

output_row.UserPhotoLoader__User_Photo_Blob__c = "<img alt=\"" + input_row.Name + "\" src=\"data:image/jpeg;base64," +
                        new String(Base64.encodeBase64(imageData)) +
                        "\"></img>";

System.out.println("+++ Conversion réussie pour " + input_row.Name);
} catch (FileNotFoundException e) {
System.out.println("*** Image non trouvée pour " + input_row.Name + "\n" + e);
} catch (IOException ioe) {
System.out.println("*** Erreur de lecture de l'image " + input_row.Name + "\n" + ioe);
}
output_row.Id=input_row.Id;
output_row.UserPhotoLoader__User_Photo_Blob__c=null;
File File=新文件(“C:/Desktop/Studio/workspace/”+
输入_row.thumbnailPhoto+“.jpg”);
试试{
FileInputStream imageInFile=新的FileInputStream(文件);
字节imageData[]=新字节[(int)file.length()];
imageInFile.read(图像数据);
imageinfle.close();
输出_row.UserPhotoLoader__User_Photo_Blob__c=“”;
System.out.println(“+++转换réussie pour”+输入行.Name);
}catch(filenotfounde异常){
System.out.println(“***图像非trouvée pour”+input_row.Name+“\n”+e);
}捕获(ioe异常ioe){
System.out.println(“***图像讲座错误”+输入行名称+“\n”+ioe);
}

不知道我做错了什么…

哪一行引发了异常?此代码只是从文件中读取图像。您是否有其他代码已经读取了
thumbnailPhoto
属性并将其保存到该文件中?没有,这是我唯一的代码…好的,因此我需要将属性thumbnailPhoto保存到我之前创建的文件中。否,您不必先将其保存到文件中。如果您只是想对其进行base64编码并将其放入
img
标记中,那么我看不出将其保存到文件的理由。我只是不知道您在哪里读到了
thumbnailPhoto
属性。什么类型是输入行?