Verificación de que un archivo.jpg está dañado a través de FiveWin és posible?
Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Verificación de que un archivo.jpg está dañado a través de FiveWin és posible?
Gracias, saludos.
"Dañado" es un término ambiguo porque podría haber partes del archivo que no estuvieran dañadas y otras que si lo estuvieran.
Se me ocurre que para comprobarlo, se podria abrir con la clase image y ver si es posible obtener el tamaño en pixeles. Si devuelve 0,0 es candidato a erroneo.
#include "FiveWin.ch"
Function u_Teste()
//Local cFile := cGetFile( "*.*", "Seleccione um arquivo" )
local cFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" + ;
"DIB (*.dib)| *.dib|" + ;
"PCX (*.pcx)| *.pcx|" + ;
"JPEG (*.jpg)| *.jpg|" + ;
"GIF (*.gif)| *.gif|" + ;
"TARGA (*.tga)| *.tga|" + ;
"RLE (*.rle)| *.rle|" + ;
"All Files (*.*)| *.*" ;
,"Please select a image file", 4 )
IF EMPTY( cFile )
MsgStop( "Please select a image file", "Please select a image file" )
RETURN NIL
ENDIF
If ValidJpg( cFile )
MsgInfo( "Imagem válida", "Imagem válida" )
Else
MsgInfo( "Imagem inválida", "Imagem inválida" )
EndIf
Return Nil
Static Function ValidJpg(cArq)
Return FITypeFromMemory(MemoRead(cArq)) >= 0
/*
By
Eduardo Motta
EMotta Sistemas - <!-- w --><a class="postlink" href="http://www.emotta.com.br">www.emotta.com.br</a><!-- w -->
<!-- m --><a class="postlink" href="http://fivewin.com.br/index.php?/topic/24614-funcao-para-verificar-jpg-resolvido/">http://fivewin.com.br/index.php?/topic/ ... resolvido/</a><!-- m -->
*/karinha wrote:Resuelto,
#include "FiveWin.ch" Function u_Teste() //Local cFile := cGetFile( "*.*", "Seleccione um arquivo" ) local cFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" + ; "DIB (*.dib)| *.dib|" + ; "PCX (*.pcx)| *.pcx|" + ; "JPEG (*.jpg)| *.jpg|" + ; "GIF (*.gif)| *.gif|" + ; "TARGA (*.tga)| *.tga|" + ; "RLE (*.rle)| *.rle|" + ; "All Files (*.*)| *.*" ; ,"Please select a image file", 4 ) IF EMPTY( cFile ) MsgStop( "Please select a image file", "Please select a image file" ) RETURN NIL ENDIF If ValidJpg( cFile ) MsgInfo( "Imagem válida", "Imagem válida" ) Else MsgInfo( "Imagem inválida", "Imagem inválida" ) EndIf Return Nil Static Function ValidJpg(cArq) Return FITypeFromMemory(MemoRead(cArq)) >= 0 /* By Eduardo Motta EMotta Sistemas - <!-- m --><a class="postlink" href="http://www.emotta.com.br">http://www.emotta.com.br</a><!-- m --> <!-- m --><a class="postlink" href="http://fivewin.com.br/index.php?/topic/24614-funcao-para-verificar-jpg-resolvido/">http://fivewin.com.br/index.php?/topic/ ... resolvido/</a><!-- m --> */
Gracias, saludos.