Jump to content

PHP Image


hackalive

Recommended Posts

I am using this QRCode https://github.com/jeromeetienne/jquery-qrcode.

 

No I need to turn it into an image so I can use it like

<img src="qrcode.php">

 

I have added "header("Content-type: image/png");"

 

but I cannot get this to work.

 

Any and all help/advice is greatly appreciated. It is starting to really annoy me :)

 

Cheers in advance.

Link to comment
https://forums.phpfreaks.com/topic/251059-php-image/
Share on other sites

The qrcode.php file is just the class definition. You would need to include/require it and then call the methods along with outputting the header, followed by the image data. Did you read through the examples at the page where you got the grcode.php file - http://d-project.googlecode.com/svn/trunk/misc/qrcode/php/

Link to comment
https://forums.phpfreaks.com/topic/251059-php-image/#findComment-1287832
Share on other sites

This is the current code

 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="../js/qrcode.js"></script>

<?php
header("Content-type: image/png");
?>

<div id="qrcode"></div>

<script>
jQuery('#qrcode').qrcode({
	width: 60,
	height: 60,
	text : "1"
});
</script>

 

If i was to visit http://mysite.com/qr.php

I see the QRcode

 

if i try to use <img src="http://mysite.com/qr.php">

it does not work!

Link to comment
https://forums.phpfreaks.com/topic/251059-php-image/#findComment-1287833
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.