Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > FireMonkey
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 16-05-2022
LACV LACV is offline
Miembro
 
Registrado: oct 2015
Posts: 80
Poder: 9
LACV Va por buen camino
Exclamation Mostrar imagen en timage

Buen dia

necesito mostrar imagenes que estan guardadas en la DB en un Timage pero no lo e logrado, la verdad ando algo perdido, si me pueden ayudar se los agredeceria
tengo este codigo, es de recordar que es un proyecto en Friemonkey


Código Delphi [-]
procedure TS.reset;
var
  JpegStream: TMemoryStream;
  Jpeg, Bitmap: TBitmap;
  tmpPos, tmpLen: integer;
  pp: string;
  Data: string;
begin
  with QueryProductos Do
  begin
    Active := false;
    Active := true;

    Data := FieldByName('ImgProd').AsString;

    try
      tmpPos := Pos('B]>', Data);
      pp := Copy(Data, 5, tmpPos - 5);
      tmpLen := StrToInt(pp);
      Data := Copy(Data, tmpPos + 3, tmpLen);

      Bitmap := TBitmap.Create;
      try
        Jpeg := TBitmap.Create;
        try
          JpegStream := TMemoryStream.Create;
          try
            TIdDecoderMIME.DecodeStream(Data, JpegStream);
            JpegStream.Position := 0;
            Jpeg.LoadFromStream(JpegStream);
          finally
            JpegStream.Free;
          end;

          with Bitmap do
          begin
            SetSize(Jpeg.Width, Jpeg.Height);

            if Canvas.BeginScene then
              try
                Canvas.DrawBitmap(Jpeg,
{$IF RTLVersion >= 31} // 10.1 Berlin or higher
                  Jpeg.BoundsF,
{$ELSE}
                  TRectF.Create(0, 0, Jpeg.Width, Jpeg.Height),
{$IFEND}
                  TRectF.Create(0, 0, 200, 160), 1.0);
              finally
                Canvas.EndScene;
              end;
          end;
        finally
          Jpeg.Free;
        end;

        Image1.Bitmap.Assign(Bitmap);
        //image1.Bitmap.LoadFromFile(Bitmap);
      finally
        Bitmap.Free;
      end;
    except
      on E: Exception do
        //
    end;

  end;
end;

Última edición por LACV fecha: 16-05-2022 a las 19:35:02.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Mostrar cada imagen de un Array of TImage. rauros Gráficos 1 04-09-2008 17:38:55
¿Mostrar barras de desplazamiento en Timage? boss475 Gráficos 2 14-04-2008 19:18:26
Borrar la imagen de un TImage xaguilars Trucos 2 01-09-2007 14:38:47
Cargar imagen en un TImage luxus OOP 3 16-02-2007 17:06:23
Mostrar TImage en aplicación externa LoBo2024 Gráficos 2 08-11-2004 12:49:20


La franja horaria es GMT +2. Ahora son las 12:48:48.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi