Recent

Author Topic: Reference image from filename  (Read 2724 times)

Zath

  • Sr. Member
  • ****
  • Posts: 354
Reference image from filename
« on: April 20, 2016, 06:37:07 pm »
I have approx. 3000 images, all 32x32 or similar.
If I want to display record data and an image for each record from an SQL table, do I need an imagelist or can I use a fixed path to the image directory and each image name which is in the format 00001.bmp through to 3300.bmp ?

The SQL table holds the image number in a field without the filetype.

Thanks for your help.
« Last Edit: April 20, 2016, 06:45:23 pm by Zath »

Michl

  • Full Member
  • ***
  • Posts: 194
Re: Reference image from filename
« Reply #1 on: April 21, 2016, 08:59:38 am »
You can do it, however you want. Save the images in a imagelist, save it in a relative path, save the images in your database. For all possibilities are reasons for.

If you want to use a image directory, you can use the event Query.OnAfterScroll, read the ID (image number) of your current field, load the image in a TImage, TPicture, TBitmap or whatever and let it paint.
Code: [Select]
type
  TLiveSelection = (lsMoney, lsChilds, lsTime);
  TLive = Array[0..1] of TLiveSelection;

SymbolicFrank

  • Hero Member
  • *****
  • Posts: 639
Re: Reference image from filename
« Reply #2 on: April 21, 2016, 10:00:39 am »
You might want to look at TDBImage first.

Zath

  • Sr. Member
  • ****
  • Posts: 354
Re: Reference image from filename
« Reply #3 on: April 21, 2016, 12:06:29 pm »
Thank you both for your replies.

The TDBImage sounds a logical step but it means I have to bring in the data to the SQL table rather than just link to it. I'd rather not do this as the program was to be an "external tool" rather than affect the main data.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 808
Re: Reference image from filename
« Reply #4 on: April 21, 2016, 12:59:43 pm »
hello,
have a look to my lazarus database example ( lazarus/examples/database/image_mushrooms )

in this example i manage images from blob field and also images from a link to  disk path.

friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Zath

  • Sr. Member
  • ****
  • Posts: 354
Re: Reference image from filename
« Reply #5 on: April 22, 2016, 05:42:45 pm »
hello,
have a look to my lazarus database example ( lazarus/examples/database/image_mushrooms )

in this example i manage images from blob field and also images from a link to  disk path.

friendly, J.P

My first attempt at this threw up errors for missing database components.
I was using 1.6.
I'll have another go tonight.

 

TinyPortal © 2005-2018