Einzelnen Beitrag anzeigen

bani

Registriert seit: 29. Apr 2008
10 Beiträge
 
Delphi XE4 Architect
 
#6

Re: jpeg aus array of byte laden

  Alt 15. Dez 2009, 08:10
Hallo zusammen

Ich habe das gleiche Problem. Ich habe ein Array mit Daten, bekomme es aber einfach nicht angezeigt.


Ich lese aus LDAP ein jpegPhoto in ein Array of Byte ein.
Nun möchte ich dies in TImage anzeigen. Ich habe schon viele Codeschnippsel aus dem Web versucht. Es klappt einfach nicht. Kann mir jemand erklären, wie ich das machen muss?


Delphi-Quellcode:
var
arr : Array of Byte;
begin
  user := GetObject(tbDatenADsPath.asString) As IADsUser;
 try

   arr := user.get('jpegPhoto');
Das Array ist gefüllt, also ich habe die Daten...

Delphi-Quellcode:
(255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 2, 1, 1, 44, 1, 44, 0, 0, 255, 225, 9, 74, 69, 120, 105, 102, 0, 0, 77, 77, 0, 42, 0, 0, 0, 8, 0, 7, 1, 18, 0, 3, 0, 0, 0, 1, 0, 1, 0, 0, 1, 26, 0, 5, 0, 0, 0, 1, 0, 0, 0, 98, 1, 27, 0, 5, 0, 0, 0, 1, 0, 0, 0, 106, 1, 40, 0, 3, 0, 0, 0, 1, 0, 2, 0, 0, 1, 49, 0, 2, 0, 0, 0, 28, 0, 0, 0, 114, 1, 50, 0, 2, 0, 0, 0, 20, 0, 0, 0, 142, 135, 105, 0, 4, 0, 0, 0, 1, 0, 0, 0, 164, 0, 0, 0, 208, 0, 45, 198, 192, 0, 0, 39, 16, 0, 45, 198, 192, 0, 0, 39, 16, 65, 100, 111, 98, 101, 32, 80, 104, 111, 116, 111, 115, 104, 111, 112, 32, 67, 83, 51, 32, 87, 105, 110, 100, 111, 119, 115, 0, 50, 48, 48, 57, 58, 48, 50, 58, 49, 48, 32, 48, 55, 58, 53, 51, 58, 53, 50, 0, 0, 0, 0, 3, 160, 1, 0, 3, 0, 0, 0, 1, 255, 255, 0, 0, 160, 2, 0, 4, 0, 0, 0, 1, 0, 0, 3, 59, 160, 3, 0, 4, 0, 0, 0, 1, 0, 0, 0, 237, 0, 0, 0, 0, 0, 0, 0, 6, 1, 3, 0, 3, 0, 0, 0, 1, 0, 6, 0, 0, 1, 26, 0, 5, 0, 0, 0, 1, 0, 0, 1, 30, 1, 27, 0, 5, 0, 0, 0, 1, 0, 0, 1, 38, 1, 40, 0, 3, 0, 0, 0, 1, 0, 2, 0, 0, 2, 1, 0, 4, 0, 0, 0, 1, 0, 0, 1, 46, 2, 2, 0, 4, 0, 0, 0, 1, 0, 0, 8, 20, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 1, 0, 0, 0, 72, 0, 0, 0, 1, 255, 216, 255, 224, 0, 16, 74, 70, 73, 70, 0, 1, 2, 0, 0, 72, 0, 72, 0, 0, 255, 237, 0, 12, 65, 100, 111, 98, 101, 95, 67, 77, 0, 2, 255, 238, 0, 14, 65, 100, 111, 98, 101, 0, 100, 128, 0, 0, 0, 1, 255, 219, 0, 132, 0, 12, 8, 8, 8, 9, 8, 12, 9, 9, 12, 17, 11, 10, 11, 17, 21, 15, 12, 12, 15, 21, 24, 19, 19, 21, 19, 19, 24, 17, 12, 12, 12, 12, 12, 12, 17, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 1, 13, 11, 11, 13, 14, 13, 16, 14, 14, 16, 20, 14, 14, 14, 20, 20, 14, 14, 14, 14, 20, 17, 12, 12, 12, 12, 12, 17, 17, 12, 12, 12, 12, 12, 12, 17, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 255, 192, 0, 17, 8, 0, 46, 0, 160, 3, 1, 34, 0, 2, 17, 1, 3, 17, 1, 255, 221, 0, 4, 0, 10, 255, 196, 1, 63, 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 1, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 0, 1, 4, 1, 3, 2, 4, 2, 5, 7, 6, 8, 5, 3, 12, 51, 1, 0, 2, 17, 3, 4, 33, 18, 49, 5, 65, 81, 97, 19, 34, 113, 129, 50, 6, 20, 145, 161, 177, 66, 35, 36, 21, 82, 193, 98, 51, 52, 114, 130, 209, 67, 7, 37, 146, 83, 240, 225, 241, 99, 115, 53, 22, 162, 178, 131, 38, 68, 147, 84, 100, 69, 194, 163, 116, 54, 23, 210, 85, 226, 101, 242, 179, 132, 195, 211, 117, 227, 243, 70, 39, 148, 164, 133, 180, 149, 196, 212, 228, 244, 165, 181, 197, 213, 229, 245, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215, 231, 247, 17, 0, 2, 2, 1, 2, 4, 4, 3, 4, 5, 6, 7, 7, 6, 5, 53, 1, 0, 2, 17, 3, 33, 49, 18, 4, 65, 81, 97, 113, 34, 19, 5, 50, 129, 145, 20, 161, 177, 66, 35, 193, 82, 209, 240, 51, 36, 98, 225, 114, 130, 146, 67, 83, 21, 99, 115, 52, 241, 37, 6, 22, 162, 178, 131, 7, 38, 53, 194, 210, 68, 147, 84, 163, 23, 100, 69, 85, 54, 116, 101, 226, 242, 179, 132, 195, 211, 117, 227, 243, 70, 148, 164, 133, 180, 149, 196, 212, 228, 244, 165, 181, 197, 213, 229, 245, 86, 102, 118, 134, 150, 166, 182, 198, 214, 230, 246, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 255, 218, 0, 12, 3, 1, 0, 2, 17, 3, 17, 0, 63, 0, 245, 84, 146, 73, 37, 41, 36, 146, 73, 74, 73, 36, 146, 82, 146, 92, 239, 214, 236, 239, 172, 120, 127, 100, 253, 135, 75, 174, 223, 234, 122, 251, 106, 245, 98, 61, 63, 75, 250, 159, 74, 197, 202, 101, 253, 112, 250, 237, 128, 89, 246, 218, 254, 207, 234, 73, 96, 182, 141, 187, 182, 198, 237, 179, 253, 100, 9, 240, 45, 238, 95, 225, 153, 121, 136, 70, 112, 158, 47, 93, 212, 37, 63, 214, 122, 127, 169, 79, 166, 164, 188, 239, 173, 125, 122, 235, 53, 12, 11, 112, 221, 93, 77, 202, 195, 101, 214, 176, 176, 56, 11, 119, 221, 77, 187, 55, 203, 182, 110, 167, 216, 187, 158, 147, 145, 110, 87, 74, 194, 202, 184, 131, 109, 248, 245, 89, 97, 2, 6, 231, 177, 175, 126, 159, 214, 114, 64, 219, 31, 49, 200, 230, 193, 142, 25, 50, 112, 212, 201, 136, 0, 250,...
Hier komme ich nicht weiter...
ich versuche

Delphi-Quellcode:
  arr := user.get('jpegPhoto');
  try
    mStream := TMemoryStream.create;
    mStream.write(arr[0], length(arr));
    mStream.Position := 0;

    b:=TBitmap.Create;
    b.LoadFromStream(mStream);


  finally
    ImPhoto.Picture.Assign(b);
    b.Free;
  end;

Doch mStream ist immer leer....

Für einen Typ, was ich falsch mache, danke ich im Voraus.

Gruss
bani
  Mit Zitat antworten Zitat