You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
I's it possible to open the file in binary for read only as the directory
containging the jpg's is read only permission.
Code:
FUNCTION JPGDims( BYVAL File AS STRING ) EXPORT AS STRING
LOCAL ErrCount AS INTEGER
LOCAL LongLoop1 AS LONG
LOCAL Lbuf AS LONG
LOCAL Buf AS STRING
LOCAL JPGy AS INTEGER
LOCAL JPGx AS INTEGER
LOCAL FileHan AS INTEGER
FileHan = FREEFILE
DO
ON ERROR RESUME NEXT
OPEN File FOR BINARY ACCESS READ AS FileHan
IF ERR = 0 THEN EXIT DO
INCR ErrCount
IF ErrCount = 100 OR ERR = 53 THEN EXIT FUNCTION
SLEEP 250
LOOP
lbuf = LOF( FileHan )
GET$ FileHan, lbuf, buf
CLOSE FileHan
LongLoop1 = 0
DO
INCR LongLoop1
IF ASC( buf, LongLoop1 ) = VAL( "&HFF" ) THEN
IF ASC( buf, LongLoop1 + 1 ) = > VAL( "&HC0" ) AND ASC( buf, LongLoop1 + 1 ) < = VAL( "&HC3" ) THEN
JPGy = ASC( buf, LongLoop1 + 5 ) * 256 + ASC( buf, LongLoop1 + 6 )
JPGx = ASC( buf, LongLoop1 + 7 ) * 256 + ASC( buf, LongLoop1 + 8 )
EXIT DO
END IF
END IF
LOOP UNTIL LongLoop1 > lbuf - 10
FUNCTION = TRIM$( STR$( JPGx )) + "/" + TRIM$( STR$( JPGy ))
END FUNCTION
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: