Fórum Carregar Imagem PNG #479239
16/05/2014
0
e quero passar a imagem do meu banco para essa variável alguém tem alguma ideia todos os métodos q usei deu erro.

Laelson Fagundes
Curtir tópico
+ 0Posts
16/05/2014
Francisco Sobrinho
a imagem está salva no banco de dados?
Veja se esta solução do robinhocne te atende:
https://www.devmedia.com.br/forum/ler-imagem-do-banco-firebird-blob/385700
Gostei + 0
18/05/2014
Laelson Fagundes
Gostei + 0
20/05/2014
Cauê Nishijima
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | procedure carregaPNG(field: TField; img: TPNGImage) var BlobStream: TStream; begin if field.IsNull then begin FreeAndNil(img); img := TPNGImage.Create; end else begin BlobStream := field.DataSet.CreateBlobStream(field, bmRead); try if BlobStream.Size <> 0 then img.LoadFromStream(BlobStream) else begin FreeAndNil(img); img := TPNGImage.Create; end; finally FreeAndNil(BlobStream); end; end; end; |
Qualquer coisa manda mensagem
Gostei + 0
20/05/2014
Wijloc
Gostei + 0
20/05/2014
Laelson Fagundes
vlw
Gostei + 0
21/05/2014
Laelson Fagundes
Outra coisa Como Usar a procedure eu teria q colocar um Timagem? eu fiquei meio perdido.
Gostei + 0
21/05/2014
Cauê Nishijima
1 2 3 4 5 6 7 8 9 10 11 12 13 | procedure Tform1.btn1Click(Sender: TObject); var foto: TPNGImage; begin foto := TPNGImage.Create; // Onde cdsConsulta é um TClientDataSet no qual esta a consulta, podendo usar outro componente // contanto que retorne um objeto do tipo TField carregaPNG(cdsConsultaFoto, foto); //Atribui a imagem a um TImage Image1.Picture.Assign(foto); end; |
Gostei + 0
27/05/2014
Nelson Santos
http://www.3dsistemas.com.br
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)