function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Saurabh46Saurabh46 

Image not Display ...

Hi all,

 

I am trying to store image in the Document...using ASCII to Image ..

 

Here is Code to Upload Document...

 

Document d = new Document();
String ascii = "0300260060035E0000FF000000FF0000FF000001FF03FF03FF05FF05FF07FF08FE09FE0AFF0CFD0BFE0DFD0CFD0DFD0CFC0BFD0AFE08FD08FF06FE05FF040003FF0200010000010001FE01FF00FF00FF0000470072035700FFFF000000FF00FE00FF00FE00FF00FF00FF000001FF010002FF02000300020003010400040104010401050105010502050204020403030403040304020502060106010601070008000801090008000901080008000801070006010601060105010401040203010201030102000101020101010101010101010101010000000000FF00FFFFFE000000FF000035006903B300FF00FF00FF00FD00FE00FD00FD00FE01FC00FE01FD01FE00FE01FF01FF010000FF01010000000201030005FF070008FF0AFF0BFF0CFE0CFF0BFF0CFF0AFF09FF07FF05FF040003FF020001000101010002010101010000000101010001000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
  
byte[] encoded = Base64.encodeBase64(ascii.getBytes());
d.setBody(decoded);
d.setFolderId(fid);
d.setName("myImage");
d.setType("jpeg");
SObject obj[] = new SObject[1];
obj[0] = (SObject) d;
connection.create(obj);
System.out.println("Completed");

 

 

Code upload the Image in JPEG Form  in the Document,but  Image is not Display...

Help me out.

 

Regards

Saurabh

 

 

Anup JadhavAnup Jadhav

Presumably this is a java code. I am not sure what the problem is, what do you mean when you say:

 

> Code upload the Image in JPEG Form  in the Document,but  Image is not Display..

 

Can you please elaborate?

 

- A

Saurabh46Saurabh46

Thanks Anup for showing interest....

Actually, i want create a document which contain Image....
but the problem is Using Image ASCII String ....

Here is the Relevant Code...

ascii="04005C009503AA0000FF010001FE02FE03FE03FD03FD02FD03FD01FD01FD00FD00FDFEFEFDFEFCFFFBFFF901F802F902F803F904F904FB04FB05FD06FF05000601060305040606050705090509040A030A040B030B030B02090309030704050403040204FF05FE05FC05FA05F805F604F604F404F502F402F400F4FFF6FFF6FDF8FCFAFCFAFBFDFCFEFDFFFD01FE02FE02FF04FF0500060007020602070307040605060506060605050606050505050404040402030201010100000000002C00F103A60000FF00FE00FDFFFC00FD00FDFFFDFFFEFFFE00FEFFFE00FF00FF00FF01FF0200020103010403040505050607050706080509050A0509050904090408040803060206010401040102FF010001FF00FE000000FF0100FF38003C047D0000FF000001FF010002000200020002010303010302040106FF06FF06FE08FC07FC07FC06FC06FC05FD03FE03FF02FF01010003FF05FF07FD09FD0BFE0DFD0DFD0EFE0EFF0EFE0EFF0CFF0B000A00090006000500040003010200010001000000FF00FE00FD01FD01FF01FF0000002100F8036001FF000000010002FE05FD09FB0AFA0DF910F811F713F714F614F714F713F712F90FF90EFB0BFB08FD06FE04FF030000000000FE02FD02FD02FD01FE010000000000000000000000000000000000000000000000000000000000000000000000000000";
Id fid=[Select f.Id From Folder f where f.name='MyFolder'].Id;
Document d = new Document();
d.FolderId=fid;
d.Name = 'Signature';
d.Body = Blob.valueOf(ascii);
d.Type = 'jpeg';
insert d;


Above code is able to create image file...but Image is not displaying..

Regards,
Saurabh

AmitSahuAmitSahu
How did you get the ASCII string? Any conversion you used?
Saurabh46Saurabh46

 

It is coming from external application and i need to convert the ASCII string to Image and store it into Document..

 

Regards,

Saurabh