Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QBJS Image Question
#1
@dbox

Does the image have to be accessible from Internet?
I found one example with that, the Chuck Norris demo.

I am trying to figure out how to get QB64 logo image into banner.

How do we get images loaded from our computer drive?
b = b + ...
Reply
#2
Testing loading an image from here:

   
b = b + ...
Reply
#3
You can either use an image that is accessible on the internet or can use image assets that are saved as part of your QBJS project.  I just actually just did a write up that explains how to do this yesterday over here:

https://qb64phoenix.com/forum/showthread...0#pid19150
Reply
#4
(08-31-2023, 05:41 PM)bplus Wrote: Testing loading an image from here:

You could certainly use that image:

Reply
#5
(08-31-2023, 05:20 PM)bplus Wrote: @dbox

Does the image have to be accessible from Internet?
I found one example with that, the Chuck Norris demo.

I am trying to figure out how to get QB64 logo image into banner.

How do we get images loaded from our computer drive?

Same-origin policy

Not that I'm any expert in the subject, but with my amateur hat on: cross-site resource sharing can be a tricky business.

If you want a QBJS instance out there on the web to have access to images, those images need to be hosted somewhere out there on the web with some kind of HTML header that allows cross-origin resource sharing.

And regarding local images/resources: nothing on the web will ever ever ever have access to local images/resources.  That should never be allowed.

A local QBJS instance should be able to access local resources, and I'm pretty sure a local QBJS instance cannot access resources on the web.  The behaviour of local QBJS might depend on device, operating system, browser.
Reply
#6
Thumbs Up 
Thanks I missed it the first time for Terry, good! looks easy enough. Smile

Update: finally got it working with the old $IF WEB trick using the above link for QBJS and a private disk file for QB64.
But I ran into a number of problems using _PutImage with grymmjack's thing for shrinking the image in QBJS, ie hard numbers won't line up with xmx and ymx constants for screen width and height. I was getting double printing of heading! So I am sticking to required 1400 x 256 and just moving screens to check drawing alignments.
b = b + ...
Reply




Users browsing this thread: 1 Guest(s)