archivo.jpg está dañado

archivo.jpg está dañado

Postby karinha » Wed Apr 20, 2016 4:09 pm

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
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: archivo.jpg está dañado

Postby Baxajaun » Thu Apr 21, 2016 8:42 am

Hola Joao,

puedes utilizar jpeginfo para comprobar su estado. Alguien que controle c puede pasar el código a FWH.

https://github.com/tjko/jpeginfo

Saludos
User avatar
Baxajaun
 
Posts: 961
Joined: Wed Oct 19, 2005 2:17 pm
Location: Gatika. Bizkaia

Re: archivo.jpg está dañado

Postby hmpaquito » Thu Apr 21, 2016 9:14 am

"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.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: archivo.jpg está dañado

Postby karinha » Fri Apr 22, 2016 12:56 pm

Resuelto,

Code: Select all  Expand view

#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 - www.emotta.com.br

http://fivewin.com.br/index.php?/topic/ ... resolvido/
*/

 


Gracias, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: archivo.jpg está dañado

Postby ACC69 » Fri Apr 22, 2016 4:22 pm

karinha wrote:Resuelto,

Code: Select all  Expand view

#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 - http://www.emotta.com.br

http://fivewin.com.br/index.php?/topic/ ... resolvido/
*/

 


Gracias, saludos.



Gracias Ing. Karinha por la rutina, es bueno tenerlo a futuro.

Saludos

Atte: Adrian C. C.
ACC69
 
Posts: 632
Joined: Tue Dec 12, 2006 7:34 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests