Reputation: 353
I'm using JQuery QRCode Written by Lars Jung. It's great.
I would like to embed image center of QRCode and there is image option for that. But, it wont show the image on center of QR.
What is valid format for image option? I have tried to use direct url without luck and cannot find any examples from documentation.
$('#mycode').qrcode({
render: 'image',
ecLevel: 'H',
size: 220,
image: 'http://localhost/logo.png',
text: 'www.google.com',
mode: 4,
label: 'Google',
fontname: 'sans-serif',
fill: '#373737',
fontcolor: '#0080ff',
mSize: 0.13,
mPosX: 0.5,
mPosY: 0.5
});
Upvotes: 0
Views: 1485
Reputation: 47
I found the solution in the source of the demo. You have to display the logo in HTML.
HTML
<img src="http://localhost/logo.png" id="logo">
JS
{ image : $("#logo")[0] }
This should be the value of the argument "image"
I already tried the following, but this did not work:
{ image : $("<img />", {src: "http://localhost/logo.png"})[0] }
Upvotes: 3