View Full Version : get the size for image files.....
manasi1128
12th January 2011, 03:28
Hi,
I want to get the size of .png files..... GetFileSize gives the size of .dll,.exe but gives 0 kb for .png files.....plzz help....
thnx in advance..!!!
MSG
12th January 2011, 05:53
GetFileSize always gives the file size, no matter what file type it is. If you get zero, then probably the file doesn't exist or it's of zero size. Or maybe it's locked and can't be opened.
Joel
12th January 2011, 06:00
This works ok, in my XP box:
Name "png_size"
OutFile "png_size.exe"
ShowInstDetails show
Function FileSizeNew
Exch $0
Push $1
FileOpen $1 $0 "r"
FileSeek $1 0 END $0
FileClose $1
Pop $1
Exch $0
FunctionEnd
Section -
Push "C:\joel\sshot-1.png"
call FileSizeNew
Pop $0
DetailPrint "$0 bytes"
SectionEnd
But, I notice when using like this:
Returns this:
Section -
Push "C:\joel\Mis imágenes\sshot-1.png"
call FileSizeNew
Pop $0
DetailPrint "$0 bytes"
SectionEnd
C:\joel\Mis imágenes\sshot-1.png bytes
Completed
Bug?
FileSizeNew wiki (http://nsis.sourceforge.net/Getting_File_Size).
MSG
12th January 2011, 07:41
Hmm. I use that function with spaces without trouble. Perhaps the accent on imagines is causing the problem? Try the unicode build.
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.