Procedure GetJpgSize(tcF) Local lcBafer, lnWhere, lnHeight, lnWidth, h h=Fopen(tcF,0) If Pcount()<2 o=Createobject("empty") Endif * the FF is first read outside the loop lcBafer=Fread(h,8192) * this is what we are looking for Store 0 To lnWidth, lnHeight lnWhere=1 Do While Between(lnWhere, 1, Len(lcBafer)) And Not Between(lnWidth, 257, 8000) And Not Between(lnHeight, 257, 8000); and not feof(h) lnWhere = At( 0hffC0, lcBafer) If lnWhere>0 lnWhere = lnWhere + 4 lnHeight = Bitor(Bitlshift(Asc(Subs(lcBafer,lnWhere+1,1)), 8), Asc(Subs(lcBafer,lnWhere+2,1))) lnWidth = Bitor(Bitlshift(Asc(Subs(lcBafer,lnWhere+3,1)), 8), Asc(Subs(lcBafer,lnWhere+4,1))) Endif lcBafer=Substr(lcBafer, lnWhere) If Len(lcBafer)<1000 And Not Between(lnWidth, 257, 8000) And Not Between(lnHeight, 257, 8000) lcBafer = lcBafer + Fread(h,8192) Endif Enddo Fclose(h) * some failsafes... lnWidth=Evl(lnWidth, 640) lnHeight=Evl(lnHeight, 480) AddProperty(o, "width", lnWidth) AddProperty(o, "height", lnHeight) Return o