dkl
Full Member
Posts: 234
|
Post by dkl on Feb 3, 2021 3:33:11 GMT -5
Can I use a url link for a photo on google drive to display that photo within LB?
I saw the HTTPGET$( url$ ) Command, but didn't have any luck with that.
|
|
|
Post by Rod on Feb 3, 2021 4:55:07 GMT -5
This gets a bmp from my host and displays it.
f$=httpget$("https://gamebin.webs.com/bump.bmp") open "temp.bmp" for output as #temp #temp f$; close #temp loadbmp "temp","temp.bmp" nomainwin 'open a window and graphicbox WindowHeight = 300 WindowWidth = 400 graphicbox #w.g, 0, 0, 400, 300 open "test" for window_nf as #w #w "trapclose [quit]" #w.g "down ; drawbmp temp 0 0" wait
[quit] close #w end
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Feb 3, 2021 7:31:29 GMT -5
I’ll give that a go, I tried something similar but just got garbage!
|
|
|
Post by Rod on Feb 3, 2021 8:43:53 GMT -5
If it isn’t a .bmp use the same technique but you will need to load it into Liberty with API code. Examples on LBPE
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Feb 3, 2021 19:07:41 GMT -5
Ah! .... I forgot it was a JPG I was downloading
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Feb 6, 2021 2:40:42 GMT -5
Hmm....
Inserted the code below into the above programme
f$=httpget$("https://drive.google.com/drive/my-drive/1408.bmp")
but no luck just a Runtime error: Invalid bitmap format. It's a standard BMP file I've used many times before
looked at the Error log, but don't understand a thing!
|
|
|
Post by honkytonk on Feb 6, 2021 3:52:56 GMT -5
Bmp from certain software or sites may not be recognized by Jb / LB Treated by "PaintStar" (freeware) they become ok
|
|
|
Post by colinmcm on Feb 6, 2021 3:57:11 GMT -5
I tried to open the url above ("https://drive.google.com/drive/my-drive/1408.bmp") directly in my browser, but got a google login screen not a bitmap file. Perhaps that is why that one did not work as expected?
|
|
|
Post by Rod on Feb 6, 2021 4:17:30 GMT -5
Yes, it would seem the file needs set up for sharing, but that must be possible else what is the point of google drive. Yes there are .bmps that will not load to Liberty. These are 32bit color bmps that use the alpha channel. If you can get to the file via your browser you can download and save it. That saved file should load to Liberty if it is an ordinary 24bit bmp.
The error log is usually in %appdata% key that into explorer then navigate to Liberty basic v 4.5.1 and open error.log, post the last section that reports the error. It will give us a clue to what is going wrong.
Oh, and just on the off chance right click on the .bmp file once it is on your PC. select properties and check on the general tab whether it shows the file as blocked, it would be at the foot of the dialog.
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Feb 6, 2021 6:52:34 GMT -5
Hmm... The file is setup for sharing. It's a standard bmp which works fine in other LB programmes, which is why I tried it. I just uploaded it from my desktop and set it up for sharing. the file it 24bit and no alpha channels.
I tried PaintStar, I just imported the file and let the programme resave it, I presume that's what you meant?
I think I'll look into your suggestion of using jpg'a with API code as well.
Below is the error log - if it's any use
Runtime error: Invalid bitmap format
Error(Exception)>>defaultAction Error(Exception)>>activateHandler: <anUndefinedObject> Error(Exception)>>handle Error(Exception)>>signal Error class(Exception class)>>signal: <'Invalid bitmap forma...'> BasicProgram(Object)>>error: <'Invalid bitmap forma...'> BasicProgram>>terminateRun: <anError> [] in BasicProgram>>errorHandlerBlock ExceptionHandler>>evaluateResponseBlock: <aBlockClosure> for: <anError> [] in ExceptionHandler>>handle: ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure> BlockClosure>>invisibleEnsure: <aBlockClosure> ExceptionHandler>>handle: <anError> ExceptionHandler>>findHandler: <anError> Error(Exception)>>activateHandler: <anExceptionHandler> Error(Exception)>>handle Error(Exception)>>signal Error class(Exception class)>>signal: <'Invalid bitmap forma...'> DIB class(Object)>>error: <'Invalid bitmap forma...'> DIB class>>fromFileStream: <aFileStream> DIB class>>fromFile: <'C:\Users\kleth\AppDa...'> in: <aDirectory> DIB class>>fromFile: <'C:\Users\kleth\AppDa...'> Bitmap class>>fromFile: <'C:\Users\kleth\AppDa...'> BasicProgram>>bmpFromFile: <'C:\Users\kleth\AppDa...'> BasicProgram>>bmpLoad: <aBasicStringContext> with: <aBasicStringContext> [] in BmpLoadCommand>>using: [] in BasicProgram>>begin ExceptionHandler>>evaluateProtectedBlock: <aBlockClosure> [] in ExceptionHandler>>activateDuring: ProtectedFrameMarker(BlockClosure)>>setUnwind: <aBlockClosure> BlockClosure>>invisibleEnsure: <aBlockClosure> ExceptionHandler>>activateDuring: <aBlockClosure> ExceptionHandler class>>handle: <anError class> with: <aBlockClosure> during: <aBlockClosure> BlockClosure>>on: <anError class> do: <aBlockClosure> BasicProgram>>begin BasicProgram>>run [] in BasicSourcePane>>run BasicCompiler class>>compileFromString: <' f$=httpget$("htt...'> notify: <aBasicSourcePane> ifSuccess: <aBlockClosure> BasicSourcePane>>run BasicSourceWindow>>run BasicEditorModel>>run: <aToolbarButton> BasicEditorModel(Object)>>perform: <#run:> with: <aToolbarButton> ToolbarButton>>triggerClickedEvent Message>>perform NotificationManager>>runPendingEvents NotificationManager>>runEventLoop Message>>perform Message>>evaluate Process>>safelyEvaluate: <aMessage> Process>>evaluate: <aMessage>
|
|
|
Post by tsh73 on Feb 6, 2021 7:11:49 GMT -5
if you have source for that file, just do compare it with file you get back. Is size of file stays the same? Does both files starts with "BM"? If you get error instead of file second file likely contains error text (HTML format) open both file in some image editir and compare information it shows for you. As alst resort upload file somewhere we could download it (without password) and check.
|
|
|
Post by Rod on Feb 6, 2021 9:01:24 GMT -5
Just set up a google drive to try. You dont get the .bmp back you get a huge dump of html. So some reading required about google drive.
edit: Ok I have tried a few of the tricks listed from google search but no luck so far. Google seems to step in and I always get html. The examples discuss pdf, ppp, docs etc but I have not found a .bmp or even a .jpg example.
Google “automatically download a .bmp from google drive” and go from there. An alternate host might be an option.
|
|
|
Post by Rod on Feb 6, 2021 10:00:50 GMT -5
|
|
dkl
Full Member
Posts: 234
|
Post by dkl on Feb 6, 2021 19:10:02 GMT -5
Hi Rod, You really have gone to a lot of trouble to try to sort this problem for me, that's very good of you:) I don't know if you have heard of GlideApps, its and excellent online programme, Similar to AppSheets that makes and iOS programme out of a spreadsheet. It reads the spreadsheet and sets up the basic interface and then the user has loads of options to change the look, function and 'beautify' it.As long as you spreadsheet doesn't use more than 500 rows its, free and you can download everything to your iphone. I have been using that with these pix and had no problems as long as I remember to 'allow sharing. The pix links are placed in google sheets, but the place the pix are stored is up to the user so I don't think it works just because I use google sheet with google drive, but I will try another cloud storage platform and see and try the same when downloading to LB. When I just use the basic LB command htmlText$ = httpget$("https://drive.google.com/drive/my-drive/1408.bmp") ' or texture.jpg print htmlText$ I do get get back a whole list of info re pic even if its a JPG. However, the moment I use your programme is when I get the error as described earlier. Your programme writes a 'temp.bmp' file to my desktop, but I can't open it it say 'unknown format' The reason I wanted to try getting the pix is simply because the GlideApp prog had inspired me to take a spread sheet and format a presentational GUI. I now wanted to add the pix. Just thought I'd give you an explanation of what this is all about! The sharing link for the file names 1408.bmp is: drive.google.com/file/d/1LJ8Ewrk1z8Yfd3IH6l2PjFOfTKAZ4P4Z/view?usp=sharingThe sharing link for the file names texture.jpg is: drive.google.com/file/d/19Gy8NzY4Tdox7taiwBD5IceFjd8444K1/view?usp=sharingI have tried inserting these into 'htmlText$ = httpget$(.......", but no success Thanks for your time:)
|
|
|
Post by Rod on Feb 7, 2021 2:32:54 GMT -5
The issue is that google drive is not sharing the .bmp or .jpg file it is instead opening an html based stream. The glide app program is able to use this stream so too the html viewer that google inserts between us and the actual file. We need to find a way round that. But it looks to me that google is deliberately avoiding being a simple ftp server and is forcing itself on you. Use my viewer, use my sheet viewer etc etc. For Liberty and a lot of other software you just want the file.
I read also about download limits. But I don’t know enough about google drive just yet. It may still be possible.
|
|