Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 3 Jahren
Letzter Beitrag:
vor 3 Jahren
Beteiligte Autoren:
Mark Crichton, Arie, Curtis

Save image in HFSQL Table

Startbeitrag von Mark Crichton am 27.05.2015 20:30

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\blob.




Use fSelect to select the image file from disk. Use HLinkMemo with HAdd or HModify to save to HFSQL table.

von Curtis - am 27.05.2015 20:35
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)

von Mark Crichton - am 27.05.2015 22:30
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.

von Arie - am 28.05.2015 06:47
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.