|
Post by Alyce on Jan 15, 2008 8:52:20 GMT -5
Not so much a bug as a caveat. This demo uncovered a glitch: runbasic.wikispaces.com/UploadAndMoveMy first attempt at writing this code used a file opened for "output" to write filedata to a new file in a created folder. It worked okay for text files, but an attempt to write the data from a bmp file and from a wav file gave me an error: unsupported characterThe error went away when I attempted to write the data to a file opened for "binary." If files opened for output only work for text data, perhaps this should be documented.
|
|
|
Post by mackrackit on Jan 15, 2008 13:38:56 GMT -5
Thank you Alyce.
I started working on the same thing last night, ran into the same problem then the power went out.
Power comes back on and the code is finished. Wish it always happened that way.
|
|
|
Post by turbov21 on Jan 16, 2008 16:39:02 GMT -5
|
|
|
Post by mikeukmid on Jan 23, 2008 16:39:19 GMT -5
I have a jpg file which loads OK into a graphic using loadgraphic statement. Copying the file, either opening for input/ouput or for binary results in a file which can not be loaded by loadgraphic, effectively leaving RB with no file copying facility. The error message is 'Incompatible image. Marker C2 cannot be handled (possible unsupported progressive scan)'
Code used to copy:
file$="C:\rbp\webcamOFF.jpg" open file$ for input as #f 'or binary filedata$ = input$(#f, LOF(#f)) close #f open "C:\rbp\webcam\webcamOFF.jpg" for output as #g 'or binary print #g, filedata$ 'with or without semicolon close #g
Mike
|
|
|
Post by mackrackit on Jan 23, 2008 17:04:27 GMT -5
Mike,
Try this
open file$ for binary as #f
instead of
open file$ for input as #f 'or binary
maybe?
|
|
|
Post by mikeukmid on Jan 23, 2008 17:35:43 GMT -5
Dave,
Thanks, but I have tried both input/output and binary.
Mike
|
|
|
Post by mackrackit on Jan 23, 2008 21:00:06 GMT -5
Mike,
I just used this and it worked here.
file$="C:\rbp\hi.jpg" open file$ for binary as #f filedata$ = input$(#f, LOF(#f)) close #f open "C:\rbp\webcam\hi.jpg" for binary as #g 'or binary print #g, filedata$ 'with or without semicolon close #g
'Load the image loadimage "banner", "hi.jpg" 'create a graphic object. graphic #g, 420, 300 'draw the image in the graphic object. #g drawimage("banner",0,0) 'display it on the web page render #g
|
|
|
Post by StefanPendl on Jan 23, 2008 23:42:53 GMT -5
Mike, I just used this and it worked here. file$="C:\rbp\hi.jpg" open file$ for binary as #f filedata$ = input$(#f, LOF(#f)) close #f open "C:\rbp\webcam\hi.jpg" for binary as #g 'or binary print #g, filedata$ 'with or without semicolon close #g
'Load the image loadimage "banner", "hi.jpg" '---snip
You are displaying the original image. If you use relative, existing paths, anyone can run your snip, without modification. The following uses PRINT with and without semicolon, an image included in the RBP installation and the temporary image folder, so it can be run on any RBP installation. file$="mandelbrot.jpg" open file$ for binary as #f filedata$ = input$(#f, LOF(#f)) close #f open "public\images\copy_test_0.jpg" for binary as #g 'or binary print #g, filedata$ 'without semicolon close #g open "public\images\copy_test_1.jpg" for binary as #g 'or binary print #g, filedata$; 'with semicolon close #g
'Load the image loadimage "banner", "public\images\copy_test_0.jpg" loadimage "banner1", "public\images\copy_test_1.jpg"
'create a graphic object. graphic #g, 400, 600
'draw the image in the graphic object. #g drawimage("banner",0,0) #g drawimage("banner1",0,300)
'display it on the web page render #g This example gives no errors and the images are displayed correctly.
|
|
|
Post by mackrackit on Jan 24, 2008 5:58:17 GMT -5
OOPPS, I was opening the original file.
Made a change Killed the original opened the correct image Now it works!
file$="C:\rbp\hi.jpg" open file$ for binary as #f filedata$ = input$(#f, LOF(#f)) close #f open "C:\rbp\webcam\hi.jpg" for binary as #g print #g, filedata$ 'with or without semicolon close #g
kill file$
'Load the image loadimage "banner", "C:\rbp\webcam\hi.jpg" 'create a graphic object. graphic #g, 420, 300 'draw the image in the graphic object. #g drawimage("banner",0,0) 'display it on the web page render #g
|
|
|
Post by mikeukmid on Jan 24, 2008 5:58:59 GMT -5
Thanks everybody, but did you notice I was using loadgraphic not loadimage? After a fresh start today I realised the file I was copying was not the one intended. It was a progressive scan jpg - hence the error message was correct. All's well now ... for now. ;D Mike.
|
|