Ver Mensaje Individual
  #3  
Antiguo 14-03-2014
Avatar de jscubillos5
jscubillos5 jscubillos5 is offline
Miembro
NULL
 
Registrado: jul 2013
Ubicacin: Bogot
Posts: 44
Reputacin: 0
jscubillos5 Va por buen camino
Unhappy Gracias

Hola Neftali, muchsimas gracias por tu ayuda, pero esto no es especficamente lo que necesito, he estado investigando, y recopilando informacin y la forma ms fcil de enviar imgenes por servicios web, es tomar la parte binaria de la imagen y transformarla a texto, ene ste caso estoy intentando hacer un demo, para lograrlo y actualmente tengo esto:

Tengo un formulario, en el cual solo tengo un control de imagen, un botn y un dialogo, en ele evento ONCLICK del boton tengo:

Cdigo Delphi [-]
procedure TForm1.ButtonTransformarImagenEnCorrienteClick(Sender: TObject);
var
  CorrienteArchivo: TFileStream;
  CorrienteEntexto: String;
begin
  // Si se ejecuta el dialogo
  if OpenDialogUPrincipal.Execute then
  begin
    try
      // Le asigno a la corriente el archivo abierto
      CorrienteArchivo:= TFileStream.Create(OpenDialogUPrincipal.FileName, fmOpenRead);
      try
        // Muestro la imagen en el control
        ImageControlUPrincipal.Bitmap.LoadFromStream(CorrienteArchivo);
        // Convierto mi corriente en texto
        CorrienteEntexto:= DeCorrienteaTexto(CorrienteArchivo);
        // Cargo el valor de CorrienteEntexto, a la propiedad TEXT del memo
        MemoUPrincipal.Text:= CorrienteEntexto;
      finally
        // Libero la corriente
        CorrienteArchivo.Free;
      end;
    except
      on E: Exception do
      begin
        // En caso de algn error
        raise Exception.Create(e.Message);
      end;
    end;
  end
  else
  begin
    raise Exception.Create('Error se debio haber ejecutado el dialogo.');
  end;
end;

La funcin DeCorrienteaTexto, tiene:

Cdigo Delphi [-]
function TForm1.DeCorrienteaTexto(Corriente: TStream): String;
var
  Temporal: TStringStream;
begin
  // Si la corriente es diferente de vacia
  if Corriente <> nil then
  begin
    // Creo mi corriente string termporal
    Temporal := TStringStream.Create('');
    try
      // Copio a mi corriente string la corriente desde la posicion 0
      Temporal.CopyFrom(Corriente, 0);
      // Le asigno al resultado el valor de mi corriente string, en la propiedad DataString
      Result := Temporal.DataString;
    finally
      Temporal.Free;
    end;
  end
  else
  begin
    Result := '';
  end;
end;

Ahora actualmente tengo solo un problema, todo el cdigo funciona, y carga los valores de forma correcta, pero cuando intento cargar el texto en el memo, el memo solo muestra hasta el primer espacio del archivo binario es decir:

Archivo binario original:

JFIF     &%"/ #'),,,150*5&+,)

 )$,)*,*,5))/))2)5,5),),)),))5./),),))),),,,,1,-),,+)  P"     9  ! 1AQ"aq2ѡBRb#3$r    $  !1A"Qa   ? gj{/'i*jquh\\F߸/Ѣuw5j~x/M EUtqsq'L֊Q
O?|v@*m;|n/{}#5#P/`:bcD"qL($
;lwT w ѱVӧ<3ybzyJ*
[?8hZ3߈uuf/@I RrPv'0Rj @бpW, afoMjK:Ś|D.KJI݌ j,Ãy>ʡ`T 51ڶҡG\vca ɽz jhHQ?cԞh)UPjE${`]@hH;yC
ܢ`~qb^/t~bHDاa~0~|i`EXtþ+]ش;:R3𐍙 -$r1~pvW*QSL5qN':V>So(oݱ_pZJ.-H<aP{<y)R.0RaM-h'Ar:V#KM9;hiDK7|TB Qؓ*p$;t“6+=,> UlIF,OXsnzt<3*fDD<"M> *0XXӿ ,*
4jE fuJ߳jR!y2o#^ؒ#l\ycr@>QZetV\K-#T
<
{ڹOUTOwi  r0pSz!Y.c0AbFSS*e_I#fX!Y55C)S `⵩YB}# ߋiP_c|1݊jzl6|+mc Z!L0LĹUe4ēn]zϖfE!J#1`dm8:gøp߃pCV\Dڢ*QgƟV4lO;1D x D@$Wnu789UM u
} ),*2pGfPC􂶝/Q#cuu2E'N2bf%@;ퟮ 0ϐ>9jPOb'am¡lHȾ 3 8;u!yx-n5xN.^7d4$*~x
lI!@)'Py×@:+.]wnfMbokio*rĆ x<#w/%BU&^ѵXœmsL40ym
p9.(UIaērb"2BE fߑKD*3$ ^7؜
u;sfP 9cP])ۧRJPFI MG?\W =Ŗ
F>LA? b*g~1] R+w3|kQs&TYYLt
;`VD̟X &l.i*Y"L_f!| *<IldzVtއ]0$
k$I qL8L(*1ᾐ _Ӗ(bj__˰e)%vk0i-7 !:I^q*i++(6V*g}RJ&$ 1jQv> UQ T$`c-ZTlL7* <Juo)eU4$DLy`.1Z d 䣟ն]uiT*Pu -xsp.#]KB9&>g& m]0WU*wye @ߙӯrM
:*țA<3,t'jS)U US$7 8w{mF:SPX /m
e ȥy.'nSSU*UfS!R uPA㗏7_hKJM*c9?h+)#$\e5Fe&]*m8W,gV*35MrBvk>S@N7e*Bu7}0+qb#*bS[!@,&f"Ty: ogk3~QII/O9b(G<g5j*Q5Rb]*9_LQ){
fJ\KW6Zט$=
y
UfY0ߐ;7`xi WգL1"wI7J<xBWPk|K0ܿ[~RyǶDS1j4j3+Rt#Ke˖sAU?үc\A)"@cLry|z,NJq(p0d :E-`<8qāj*B9zj $-^L>=Ͱ*r*]-4*+[ *U@!}N.dYZ̻eYu

Texto mostrado en el memo:



Y no se por que??
__________________
De ante mano gracias por tomarse el tiempo de leer este Hilo.

-------------------------------
Juan Sebastin Cubillos Gonzalez
Desarrollador de soluciones informticas.
Bogot, Colombia.
Encuentra me en: http://www.linkedin.com/pub/juan-seb...lez/66/1b8/150
Responder Con Cita