PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 24 → Salvar Video
Salvar Video
Débuté par adrianoboller, 24 nov. 2014 12:46 - 1 réponse
Membre enregistré
3 092 messages
Popularité : +89 (91 votes)
Posté le 24 novembre 2014 - 12:46
Procedure CAM_SalvarVideo(LOCAL Escolha, LOCAL Descricao, LOCAL DebugSN)

IF gsDebugSN = "S"
DebugSN="S"
END

ok1 is boolean = False

IF Arquivo <> "" AND fFileExist(Arquivo) = True THEN

IF Escolha = "S"
//1 : Sim
//2 : Não
SWITCH Dialog("Deseja salvar video?")
// Sim
CASE 1

T020Arquivo.Tipo020 = "Video"

T020Arquivo.Observacao020 = Descricao

T020Arquivo.DataHora020 = DateToString(DateSys()) +" - "+ TimeToString(TimeSys())

T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo,imgDefault,640,480)

ok1 = HAdd(T020Arquivo)
IF DebugSN = "S"
IF ok1 = True THEN
Info("Gravado na base de dados com sucesso!")
ELSE
Info("Erro ao gravar na base de dados")
END
END

// Sim
CASE 2

END

ELSE IF Escolha = "N"

T020Arquivo.Tipo020 = "Video"

T020Arquivo.Observacao020 = Descricao

T020Arquivo.DataHora020 = DateToString(DateSys()) +" - "+ TimeToString(TimeSys())

T020Arquivo.FotoVideo020 = dLoadImage(ArquivoNovo,imgDefault,640,480)

ok1 = HAdd(T020Arquivo)

IF DebugSN = "S"
IF ok1 = True THEN
Info("Gravado na base de dados com sucesso!")
ELSE
Info("Erro ao gravar na base de dados")
END
END

END

END
Membre enregistré
3 092 messages
Popularité : +89 (91 votes)
Posté le 05 avril 2016 - 22:13
Prezados,

Segue alguns detalhes apontados pelo Danilo Valim

//********************************************************************
//Gerando imagem usando crypt
//********************************************************************
bufImageBuffer is Buffer = ""
sImageString is string = ""

bufImageBuffer = fLoadBuffer(IMG_1)

sImageString = Crypt(bufImageBuffer,"",cryptNone)
//sImageString = Crypt(bufImageBuffer,"TesteSenhaCript",cryptFast) //Com criptografado com senha

//info(length(sImageString)) - Qtde de Caracteres da Imagem Serializada - 3324508




//********************************************************************
//Usando Código dessa Forma Consigo Inserir uma Imagem de Tamanho - 2,31 Mb
//********************************************************************
gdsConsulta is Data Source
HClose(gdsConsulta)

gsQuery is string = "Execute Cadastro_Anexo "+EDT_Nome_Imagem+" ,'"+sImageString+"',0"
IF NOT HExecuteSQLQuery(gdsConsulta,CONN2, hQueryWithoutCorrection, gsQuery) THEN
Info(HErrorInfo())
ELSE
HReadFirst(gdsConsulta, MsgProd)
WHILE HOut() = False
IF gdsConsulta.MsgProd <> "OK" THEN
Error(gdsConsulta.MsgProd)
ELSE
Info("OK")
END
HReadNext(gdsConsulta)
END
END



//*********************************************************************************
//Usando esse Código, dessa Forma da Estouro de Buffer, Variavel sImageString
//vai Cortada e da Erro, não funciona, não use HEXECUTEQUERY, USE
//HEXECUTESQLQUERY, É MAIS ADEQUADO.
//***********************************************************************************
IF HExecuteQuery(QRY_Insert_Foto,hQueryDefault,EDT_Nome_Imagem,sImageString) = False THEN
Info(HErrorInfo())
ELSE
Info("Imagem salva com Sucesso!!")
END



//*********************************************************************************
//Dessa Forma também da Estouro de Buffer, Variavel sImageString vai
//Cortada e da Erro, não funciona
//***********************************************************************************
dsQry_Sql is Data Source

sQl_execute is string =
[
Insert INTO Anexo_Teste
(
NomeAnexo,
Foto
)
VALUES
(
'@NomeAnexo@',
'@Foto@'
)
]

sQl_execute = Replace(sQl_execute,"@NomeAnexo@",EDT_Nome_Imagem)
sQl_execute = Replace(sQl_execute,"@Foto@",sImageString)

ok is boolean = HExecuteSQLQuery(dsQry_Sql,hQueryDefault+hCheckDuplicates+hCheckIntegrity,sQl_execute)
IF ok = True THEN
Info("OK")
ELSE
Info(HErrorInfo(),ErrorInfo())
END




//***********************************
Conteudo da variavel sImageString
//***********************************

/9j/4QJMRXhpZgAASUkqAAgAAAAMAAABBAABAAAAIBAAAAEBBAABAAAAGAwAAA8BAgAIAAAAngAAABAB
Ag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nd4eXqDhIWGh4iJipKTlJWWl5iZ
mqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6AQAD ........


//Obs: Nao da certo de terminar de montar o INSERT, Corta no meio o Insert.


:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/