neumannon wrote:Alright! I am testing the image upload feature of the site. For some reason when I tried uploading a png file, it said the file wasn't allowed even though png is in the list of allowed image formats. Must not have support for png images yet. No biggie though. I just removed .png as a possible image format for upload. I was able to get the jpg screenshot uploaded.
So here is the download.php screenshot modded for qr code...
I added the below code to the [root]/download.php file. There are various parameters for the google function which can be adjusted. I left the defaults alone and seems to work well. There may be an easier way to get the current URL for encoding but that was the one I was able to find.
- Code: Select all
function generateQRwithGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
$url = urlencode($url);
echo '<img src="http://chart.apis.google.com/chart?chs='.$widhtHeight.
'x'.$widhtHeight.'&cht=qr&chld='.$EC_level.'|'.$margin.
'&chl='.$chl.'" alt="QR code" widhtHeight="'.$size.
'" widhtHeight="'.$size.'"/>';
}
function currPageURL()
{
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
Then I added this line to [root]/styles/Indigo/download.php at the bottom of the table. Of course it can be put anywhere on the page.
- Code: Select all
<?php
$urlToEncode=currPageURL();
?>
<tr><td align=left valign=top bgcolor=#F4F4F4 background="img/button03.gif\">QR Code: </td><td bgcolor=#EEF4FB background="img/button03.gif"><?php generateQRwithGoogle($urlToEncode);?></td></tr>
I hope that helps out anyone interested in doing the same thing. If there is an easier/simpler way to do any of this, please let me know and I'll make the change.
And this was done on the 1.2.3 DFH release.
Return to Hacks and Modifications
Users browsing this forum: No registered users and 5 guests