QR Code

Any hacks and modifications will be in here...

QR Code

Postby neumannon » Thu Nov 03, 2011 2:59 pm

Anyone try adding a scannable code (QR Code or whatever) to the file download file page? I may mod the download php page if it hasn't been done. That may be a cool feature for a future release.
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby SamEA » Fri Nov 04, 2011 2:02 am

At the moment there are no QR Codes/scannable codes in any DFH release, but feel free to mod this into the download page :). If successful, it will be included in a future release.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: QR Code

Postby neumannon » Fri Nov 04, 2011 12:09 pm

I was able to mod the download.php file to show a qr code for downloading the file on a mobile device. It was actually quite simple using the google qr code api. When I have a chance, I will post the code with a screenshot of the result. I am a noob to php so there may have been a better way to implement but it works and I'm happy :). Stay tuned...
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby SamEA » Fri Nov 04, 2011 2:07 pm

neumannon wrote:I was able to mod the download.php file to show a qr code for downloading the file on a mobile device. It was actually quite simple using the google qr code api. When I have a chance, I will post the code with a screenshot of the result. I am a noob to php so there may have been a better way to implement but it works and I'm happy :). Stay tuned...


No ones 100% when it comes to coding and besides, the more one codes the more experience he/she will gain in how to (style) code more efficiently. Well done and I look forward to your mod.

SamEA
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: QR Code

Postby neumannon » Fri Nov 04, 2011 3:07 pm

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...
Image

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.
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby neumannon » Fri Nov 04, 2011 3:11 pm

And don't try to scan that code btw. I just loaded DFH the other day and I have only been doing testing on the local host. so the URL for that code is localhost and not my actual public hostname. I just did test using my public domain name and it worked perfectly on my phone. WooHoo!
Last edited by neumannon on Fri Nov 04, 2011 3:21 pm, edited 1 time in total.
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby neumannon » Fri Nov 04, 2011 3:15 pm

I suppose I could also add that to the view image page as well.
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby neumannon » Fri Nov 04, 2011 4:28 pm

Image viewer page has been modded too. Takes me right to the image on my phone.
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Re: QR Code

Postby SamEA » Tue Nov 08, 2011 11:04 am

Any functioning demo available? Thank you.
SamEA,
DaddyScripts' Admin & Developer.

Require a PHP or general IT freelancer? Don't hesitate to PM me.
User avatar
SamEA
Site Admin
 
Posts: 1165
Joined: Sat Feb 19, 2011 7:51 pm

Re: QR Code

Postby neumannon » Tue Nov 08, 2011 3:38 pm

Ha, in my excitement I forgot to post demos.

Here is one for a normal file download.
http://home.sk1llsh0t.com/dfh/download.php?file=608online.wav

Here is one for the image viewer.
http://home.sk1llsh0t.com/dfh/viewer.php?id=52545Desert.jpg
neumannon
Standard Member
 
Posts: 9
Joined: Thu Nov 03, 2011 1:29 pm

Next

Return to Hacks and Modifications

Who is online

Users browsing this forum: No registered users and 4 guests

cron