Jump to content


Photo

NextDBGrid5 in Slide Mode, Graphic - not stored as BLOB


  • Please log in to reply
2 replies to this topic

#1 Maik2

Maik2
  • Members
  • 13 posts

Posted 09 November 2025 - 03:14 PM

Hello,
 
I'm using NextDBGrid5 in slide mode in my application.
I'd like to display one graphic at a time, as shown in the screenshot.
However, the photos aren't stored as BLOBs in the database; only the actual filename, including the path, is stored.
 
Could you perhaps show me a solution (code example) to achieve this successfully?
 
Thank you in advance.
 
 
Attached File  Screenshot 2025-11-09 131728.png   16.97KB   0 downloads


#2 Maik2

Maik2
  • Members
  • 13 posts

Posted 10 November 2025 - 08:59 PM

procedure TFormTagelohnauftraege.NextDBGrid1CustomDrawCell(Sender: TObject;
  ACol, ARow: Integer; CellRect: TRect; CellState: TCellState);
var Image : TImage;
    Foto  : string;
begin
  if ACol=28 then begin
    Image := TImage.Create(Self);
    try
      Foto := Bilderpfad + '\' + MySQL_DataModule.QueryTG.FieldByName('DATEINAME_FOTO1').AsString;
      Image.Picture.LoadFromFile(Foto);
      NextDBGrid1.Canvas.StretchDraw(CellRect, Image.Picture.Graphic);
    finally
      Image.Free;
    end;
  end;
end;

I've solved it this way now. But I don't know if this is the recommended or correct way...



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,266 posts
  • Gender:Male

Posted 23 November 2025 - 06:36 PM

Hello,

 

Please sorry for the huge delay. Your solution is good, but if you have some smaller number of records, I would cache them in some way. But if the images are small and it work fast for you then it's ok.

 

I will personally try to see if the image is on screen (record is loaded) and then load image from TList<TGraphic>


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users