Alguien sabe como se guarda una imagen en una dbf y como se debe leer para presentarla en la pantalla
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
Gracias...
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Saluditos
![Wink :wink:](./images/smilies/icon_wink.gif)
Code: Select all | Expand
function guardaImg()
local rutaimg := ".\imgs\laimagen.bmp"
local rutaTXT := ".\imgs\laimagen.txt"
//CONVERTIMOS LA IMAGEN A TEXTO
fMimeEnc( rutaimg, rutaTXT ) //Convertimos la imagen en base64
cText := MemoRead( rutaTXT ) //Con la info en la variable la puedes guardar en la dbf
hmpaquito wrote:A no ser que sean pocas imágnes, es muy desaconsejable guardar las imagenes en las tablas, sean .dbf o sean tablas Mysql
karinha wrote:hmpaquito wrote:A no ser que sean pocas imágnes, es muy desaconsejable guardar las imagenes en las tablas, sean .dbf o sean tablas Mysql
De acuerdo. Mejor és guardar en archivos .RC ó .RES.
IMAGENES.RES
IMAGENES2.RES
IMAGENES3.RES
etc.
Saludos.
leandro wrote:Una ideaCode: Select all | Expand
function guardaImg()
local rutaimg := ".\imgs\laimagen.bmp"
local rutaTXT := ".\imgs\laimagen.txt"
//CONVERTIMOS LA IMAGEN A TEXTO
fMimeEnc( rutaimg, rutaTXT ) //Convertimos la imagen en base64
cText := MemoRead( rutaTXT ) //Con la info en la variable la puedes guardar en la dbf
Code: Select all | Expand
DBCREATE( "MYIMAGES", { { "NAME", "C", 10, 0 }, { "IMAGE", "M", 10, 0 } }, "DBFCDX", .T., "IMG" )
DBAPPEND()
FIELD->NAME := "OLGA1"
FIELD->IMAGE := MEMOREAD( "c:\fwh\bitmaps\olga1.jpg" )
DBAPPEND()
FIELD->NAME := "SEA"
FIELD->IMAGE := MEMOREAD( "c:\fwh\bitmaps\sea.bmp" )
GO TOP
XBROWSER
Code: Select all | Expand
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oFont, oBrw, oImage
USE MYIMAGES NEW VIA "DBFCDX"
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,500 PIXEL TRUEPIXEL FONT oFont
@ 20, 20 XBROWSE oBrw SIZE 150,-20 PIXEL OF oDlg ;
DATASOURCE "MYIMAGES" COLUMNS "NAME" LINES NOBORDER
WITH OBJECT oBrw
:bChange := { || oImage:Refresh() }
//
:CreateFromCode()
END
@ 20,200 XIMAGE oImage SOURCE MYIMAGES->IMAGE SIZE -20,-20 OF oDlg
ACTIVATE DIALOG oDlg CENTERED ON INIT oImage:Refresh()
RELEASE FONT oFont
return nil
Hello, I have thought that the photos that the user wants to save are saved in a dbf
nageswaragunupudi wrote:Hello, I have thought that the photos that the user wants to save are saved in a dbf
Yes. We can save the photos that the user wants.
Can you explain what exactly you are looking for?
nageswaragunupudi wrote:Sample-2
Using the DBF we created above:Code: Select all | Expand
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oFont, oBrw, oImage
USE MYIMAGES NEW VIA "DBFCDX"
DEFINE FONT oFont NAME "VERDANA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,500 PIXEL TRUEPIXEL FONT oFont
@ 20, 20 XBROWSE oBrw SIZE 150,-20 PIXEL OF oDlg ;
DATASOURCE "MYIMAGES" COLUMNS "NAME" LINES NOBORDER
WITH OBJECT oBrw
:bChange := { || oImage:Refresh() }
//
:CreateFromCode()
END
@ 20,200 XIMAGE oImage SOURCE MYIMAGES->IMAGE SIZE -20,-20 OF oDlg
ACTIVATE DIALOG oDlg CENTERED ON INIT oImage:Refresh()
RELEASE FONT oFont
return nil
Code: Select all | Expand
FIELD->MEMOFIELDNAME := MEMOREAD( <anyfile> )
nageswaragunupudi wrote:You can store any data in a memofield:Code: Select all | Expand
FIELD->MEMOFIELDNAME := MEMOREAD( <anyfile> )
When reading, how do you plan to show pdf, docx files, etc?