PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Save image in HFSQL Table
Save image in HFSQL Table
Iniciado por guest, 27,may. 2015 22:30 - 3 respuestas
Publicado el 27,mayo 2015 - 22:30
Hi
Trying to save an image into an HFSQL table rather than keep image as file on disk.
( project converted from PostgreSql )
I can display existing records easily on screen

Need to code button to select image file from disk and save to table as binary\lob.
Publicado el 27,mayo 2015 - 22:35
http://doc.windev.com/en-US/…

http://doc.windev.com/en-US/…

Use fSelect to select the image file from disk. Use HLinkMemo with HAdd or HModify to save to HFSQL table.
Publicado el 28,mayo 2015 - 00:30
Thanks Curtis
HLinkMemo was the missing piece
Here is my code that's working perfectly.

// Step 1 - Set Environ & Variables
sImageFile is string
nFileID is int
// Retrieve the list of image formats supported by WinDev
sListImageFiles is string
sListImageFiles = fGraphicFilter()


// Step 2 - Selecting the file
sImageFile = fSelect("", "", "Select a file...",sListImageFiles , "", selOpen+fselExist)

// Step 3 - Save to products table if a file is selected
IF sImageFile <> "" THEN
// Displays the image in the control
IMG_Prdimage = sImageFile
// save the file filename and path to table
fixproduct.prdimage = HLinkMemo(fixproduct,prdimage,sImageFile,hMemoBin,sImageFile)
HModify(fixproduct,hCurrentRecNum)
END
Publicado el 28,mayo 2015 - 08:47
Hi Mark,
have a look at the thumbnail option of HFSQL also.
You can define 1 or more sizes for thumbnails, you need for your blob-field. And the hyperfile-engine will automatically generate them for you. And store them in the same blobfield as well.

Whenever you need to show the images, Windev is smart enough to load the proper thumbnail (when your imagecontrol is "databind" to the blobfield). Or you can extract it yourself by using something like this: img_control = fxproduct.prdimage..Thumbnail[1]

Depending on your application it could speed up things a lot.