kb of Image

kb of Image

Postby Silvio.Falconi » Mon Sep 30, 2013 1:28 pm

How I can show with a say the kb of a image ( load from getfile() ) ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: kb of Image

Postby MaxP » Mon Sep 30, 2013 4:35 pm

Something like that?

Code: Select all  Expand view

#include "FiveWin.ch"


function Main()
        LOCAL   nSize, oWnd, oFont
       
        nSize := ROUND( FSIZE( "C:\prova.bmp" ) / 1024, 0 )  
       
        DEFINE WINDOW oWnd FROM 1, 1 TO 20, 50 TITLE "Testing"
       
        @ 10, 10 SAY ALLTRIM( STR( nSize ) ) + " KB" OF oWnd SIZE 60, 25 PIXEL COLOR "N/W*"
               
        ACTIVATE WINDOW oWnd                
return nil
 
User avatar
MaxP
 
Posts: 85
Joined: Thu Jul 12, 2007 2:02 pm

Re: kb of Image

Postby Silvio.Falconi » Mon Sep 30, 2013 5:25 pm

YES mAX THANKS...

When I load the mage the name of the file is not refresh please run this test
Code: Select all  Expand view
#include "FiveWin.ch"
#include "constant.ch"

STATIC oSay[6],oChk[2]
STATIC cNameImage,dDateModImage,nSizeImage
STATIC oImage


Function TEST(cfile)
   Local  oDlg
   Local  oBar
   Local  nBottom   := 35
   Local  nRight    := 110
   Local  nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   Local  nHeight := nBottom * DLG_CHARPIX_H
   LOCAL  lSetAlpha := .t.

   if ! Empty( cfile ) .and. File( cfile )
          cNameImage:= cfile
   ELSE
        cNameImage:= Space(160)
        nSizeImage:= 0
        dDateModImage := ctod("  /  /  ")
     ENDIF

DEFINE DIALOG oDlg  SIZE nWidth, nHeight    ;
                      TITLE "Immagine"



    @ 0, 0 IMAGE oImage SIZE 350, 150 OF oDlg SCROLL

   oImage:Progress( .f. )



    @ 160,10 SAY oSay[1] PROMPT "Nome file       :"  of oDlg SIZE 50,10  PIXEL
    @ 180,10 SAY oSay[2] PROMPT "Dimensioni      :"  of oDlg SIZE 50,10  PIXEL
    @ 210,10 SAY oSay[3] PROMPT "Ultima modifica :"  of oDlg SIZE 50,10  PIXEL
    @ 160,60 SAY oSay[4] PROMPT  cNameImage          of oDlg SIZE 50,10  UPDATE PIXEL
    @ 180,60 SAY oSay[5] PROMPT  nSizeImage          of oDlg SIZE 50,10  UPDATE PIXEL
    @ 210,60 SAY oSay[6] PROMPT  dDateModImage       of oDlg SIZE 50,10  UPDATE PIXEL

     @ 210,200 BUTTON OBTN PROMPT "SELECT IMAGE" SIZE 45,10 OF OdLG  ACTION GetImage( oImage )   PIXEL

ACTIVATE DIALOG oDlg CENTERED
return nil

function GetImage( oImage )

   local gcFile := 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( gcFile ) .and. File( gcFile )
      oImage:LoadBmp( gcFile )


        cNameImage     := alltrim(gcFile)
        nSize := ROUND( FSIZE( gcFile ) / 1024, 0 )
        nSizeImage     :=   ALLTRIM( STR( nSize ) ) + " KB"
        dDateModImage  := FDATE(gcFile)
         oSay[4]:refresh()
         oSay[5]:refresh()
         oSay[6]:refresh()

   endif



 




NOW i CAN SEE THE NAME BUT MIDDLE
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: kb of Image

Postby Silvio.Falconi » Mon Sep 30, 2013 5:37 pm

SORRY i RESOLVED SORRY


THIS IS THE RESULT

Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests