Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Teensy 4.1 qnethernet 2k limit? #49

Answered by videojedi
videojedi asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I have a solution.

I've added a fetch in the javascript, that pulls the base64 image and replaces the HTML image src with the received text.

There's probably a better way, but this does seem to work.

index.h
<img src="logo" width="50" height="50" alt="logo" />

logo.h
const char logo[] PROGMEM =R"rawLiteral(iVBORw0KGgoAAAANSUhEUgAAABQAA ........ )rawLiteral";

app.ino
server.on("/logo", handleLogo);

void handleLogo(){ server.send_P(200,"text/plain",logo); }

script.h

const url = '/logo'

const getImage = async (url) => {
       return await fetch(url).then(res => res.text())
    }

function getLogo(){
    getImage(url)
      .then(result => {
        document.getElementById('logoImage')…

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@khoih-prog
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by videojedi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants