Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
QR Code

 

 


Toledoh
Enthusiast

Jun 8, 2011, 3:23 PM

Post #1 of 20 (4952 views)
Shortcut
QR Code Can't Post

Hey guys,

How do I put the current page full URL into the following;


Code
					<?php echo qrCode(array(  
'type' => 'url',
'url' => 'http://www.example.com/',
'size' => '100',
)); ?>


I want to place this code on a product page.
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


Toledoh
Enthusiast

Jun 8, 2011, 3:27 PM

Post #2 of 20 (4951 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Also, is it possible to tie in css classes to the produced image?

ie.


Code
<img width="100" height="100" src="http://chart.apis.google.com/chart?cht=qr&chs=100x100&chl=http%3A%2F%2Fwww.example.com%2F&chld=%7C0">

is currently the output, but I want to add

Code
class="qrCode"

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


Toledoh
Enthusiast

Jun 8, 2011, 11:35 PM

Post #3 of 20 (4933 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

AND...

The "type" field in the plugin examples are great, but there are other functions like maps, SMS, phone etc.

Are there ways of adding these functions?
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


robin
User / Moderator


Jun 9, 2011, 9:37 AM

Post #4 of 20 (4922 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Hey Tim,

1.
Here is a simple example of how put the current page in the qr generator:

Code
'url' => "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"],


2.
If you want a custom image tag you can use the 'mode' option. If mode is set to url, then it just returns the image url instead of an image tag.

Code
'mode'  => 'url'


3.
If there are more qr code functions you would like to see added it doesn't hurt to send us what they are maybe with some documentation.
Otherwise you can manually emulate other qr code types with the text type.

Hope that helps,
Robin


Toledoh
Enthusiast

Jun 9, 2011, 3:05 PM

Post #5 of 20 (4917 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Thanks Robin!

I've seen (ie. http://5sec-qrcodes.webfactoryltd.com/documentation) that you can have tel and sms that will call the function on your phone...

For instance, a competiton may be to "TXT "chocolate" to 1123456 for your chance to win"

The php code should be something like;

Code
<?php echo qrCode(array( 'type' => 'sms', 'number' => 'user@example.com' )); ?>

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


robin
User / Moderator


Jun 10, 2011, 8:32 AM

Post #6 of 20 (4908 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Thanks Tim,

I'll add SMS to the to-do.

Robin


Toledoh
Enthusiast

Jun 10, 2011, 4:01 PM

Post #7 of 20 (4903 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Great Robin - thanks.

Could you do tel as well? It generates a phone call the the identified number.

<?php echo qrCode(array( 'type' => 'tel', 'number' => '123456789' )); ?>
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


gkornbluth
Veteran

Jun 11, 2011, 9:42 AM

Post #8 of 20 (4829 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Hi Robin,

Excellent thread.

In an implementation using the QR code plugin, I’ve need to generate large QR Code images, so that my client can easily include the codes in their printed materials.

WHAT I FOUND
There's a maximum allowed value for the “size” parameter of 547 pixels. According to Google, anything over that would exceed their generator’s 300,000 pixel maximum size design parameter. (548 x 548 = 300,304)

http://code.google.com/apis/chart/image/docs/chart_params.html

A 547 px image allows for a 2.75" x 2.75", high resolution print to be created directly from the image. 200 ppi is pretty much the minimum resolution required for quality printing without too many jaggies, so this size is usually adequate for most print applications.

THE CHALLENGE
A 547 x 547 pixel image is a bit large for display as a thumbnail on a list page of QR Codes and corresponding titles/URLs.

WHAT’S NEEDED
Does anyone know a way to generate thumbnails of the larger generated QR codes that when clicked would display the full sized image for copying and download, similar to the way CMSB thumbnails work.

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com

(This post was edited by gkornbluth on Oct 20, 2011, 10:44 AM)


Toledoh
Enthusiast

Jun 11, 2011, 4:00 PM

Post #9 of 20 (4791 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

Hi Jerry.

If I understand correctly, couldn't you simply create the full sized QR Code using the "mode" function above. Then in the HTML use height and width in the img tag to make a smaller version? then link to the full size?

Or, if you can't shrink it, use the size option to create a small version and link it to a large version?

ie. <a href="[php for big version]">[php for small version]</a>

Maybe I'm missing something?
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


gkornbluth
Veteran

Jun 11, 2011, 7:34 PM

Post #10 of 20 (4772 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Tim,

Thanks for the direction. I guess I just couldn’t think clearly about it. (gotta stop these extra long days)

I ended up creating a “large_QR-code” page and linking to that page from the small QR code. After a bit of playing around, it works perfectly.

My client has asked me not to post the code for this just yet, but I’ll document it all in my Cookbook shortly.

Again thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


gkornbluth
Veteran

Jun 20, 2011, 6:24 PM

Post #11 of 20 (4439 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Hi Robin,

Any way to name the generated QR Code files based on a "title" field in the requesting record instead of them all being called chart.png?

One of my clients has already gotten confused and put the wrong codes in the wrong places.

(Hope I didn't just overlook this in the documentation)

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


robin
User / Moderator


Jun 21, 2011, 9:35 AM

Post #12 of 20 (4405 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

Hey Jerry,

The google api that the chart generator uses always names the images as "chart.png". Without resorting to something fancy like using jquery to rename the images after the fact I think you're stuck with chart.png.

Robin


gkornbluth
Veteran

Jun 21, 2011, 2:03 PM

Post #13 of 20 (4398 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Hi Robin,

What do you think it would take to solve this issue using Jquery?

I think this naming thing could be a real stumbling block as QR codes become more widely used.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com


robin
User / Moderator


Jun 22, 2011, 10:02 AM

Post #14 of 20 (4380 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

Hey Jerry,

This method might help:
http://api.jquery.com/attr/

I wonder - why does your client care about the file name? Are they generating them just to save the image to use elsewhere?

Thanks,
Robin


gkornbluth
Veteran

Jun 22, 2011, 11:24 AM

Post #15 of 20 (4378 views)
Shortcut
Re: [robin] QR Code [In reply to] Can't Post

Hi Robin,

Appreciate your looking into this.

We're generating a list of QR codes for a potentially long series of records, and then copying individual codes from that list into documents for various print media campaigns.

A few codes are easy to keep track of and even manually rename, but if one gets out of place in a longer list, it's near impossible to sort them out.

I hate to admit it, but I’ve stared at the http://api.jquery.com/attr/ docs for quite a while, and I still haven’t a clue how to implement it in the following, to change the file names of the generated QR codes from chart.png to <?php echo$record['title'] ?>.png:

Thanks for any help you can offer,

Jerry


Code
<table border="0"> 
<tr>
<td align="center"><hr /></td>
</tr>
<?php foreach ($my_list_Records as $record): ?>
<?php $num = $record['num'] ?>
<tr>
<td align="center">
<?php echo strtoupper($record['title']) ?>
</td>
</tr>
<tr>
<td align="center" valign="top">
<!--Show QR code with title and record number-->
<?php
echo qrCode(array(
'type' => 'url',
'size' => '547', // thumbnail height & width in pixels
'url' => 'http://www.mysite.com/my_detail.php?' . $num
));
?>
<br />
<br />
URL to the target for this record: http://www.mysite.com/my_detail.php?<?php echo $num ?>
<hr />
</td>
</tr>
<?php endforeach ?>
</table>

Code



      
    


Toledoh
Enthusiast

Jun 24, 2011, 3:56 PM

Post #16 of 20 (4335 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

Hey Guys.

QR Codes are great, as they can hold a lot of data. However, the more data they hold, the more complex they become. The less data, the faster the response is, especially with smart-phone apps.

There's a plethora of URL shortening such as http://goo.gl/

I've attached a sample image. It's of 2 QR codes pointing to the same address - one of the full URL, one of a shortened URL. The difference is quite dramatic.

So... is there the ability to automatically shorten URL's and use that shortened URL to generate the QR Code?
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au
Attachments: sample.png (2.09 KB)


gkornbluth
Veteran

Jun 24, 2011, 7:30 PM

Post #17 of 20 (4325 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Hi Tim,

Interesting that you should bring that up.

I'm exploring the same question right now.

Here are s few things that I found so far (I haven"t got a clue how to use them, but they may give someone an idea or two)

http://www.mdj.us/snews-cms/hacks-mods/automatically-add-autogenerated-short-urls-to-your-snews-cms/ a now defunct sourceforge project http://lilurl.sourceforge.net/,

and then do a Google search for open source short url generator.

I'll post what else I find and hope you'll do the same.

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
http://www.thecmsbcookbook.com

(This post was edited by gkornbluth on Jun 24, 2011, 8:20 PM)


Toledoh
Enthusiast

Jun 27, 2011, 9:55 PM

Post #18 of 20 (4203 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

This may be of interest:

http://www.fivetechnology.com/blog/2011/06/27/creating-qr-codes-and-tracking-progress-with-google-analytics/

But, it highlights even more, the need for URL shortening...

I've added this to a page:

Code
<img src="<?php echo qrCode(array( 
'type' => 'url',
'url' => "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"],
'mode' => 'url',
'size' => '200',
)); ?>&utm_source=source&utm_medium=medium&utm_term=term&utm_content=content&utm_campaign=name" class="padBottom" alt="QR Code" />


However, I get

Code
<img class="padBottom" alt="QR Code" src="http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=http%3A%2F%2Fworkshoptuesdays.com.au%2Frenovationfix%2Fcoupon2.php%3Fcode%3D21hgh214y314bh13&chld=%7C0&utm_source=source&utm_medium=medium&utm_term=term&utm_content=content&utm_campaign=name">

which doesn't seem to work... when I scan the code, it seems to skip the tags - or is this meant to happen?
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

(This post was edited by Toledoh on Jun 27, 2011, 11:05 PM)


Toledoh
Enthusiast

Jun 27, 2011, 10:03 PM

Post #19 of 20 (4202 views)
Shortcut
Re: [gkornbluth] QR Code [In reply to] Can't Post

http://googlecode.blogspot.com/2011/01/google-url-shortener-gets-api.html
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au


Toledoh
Enthusiast

Jun 27, 2011, 10:37 PM

Post #20 of 20 (4200 views)
Shortcut
Re: [Toledoh] QR Code [In reply to] Can't Post

Hi All,

Would someone with more knowledge than myself be able to incorproate this into the QRCode plugin? Or should it be a plugin by itself?

http://www.phpriot.com/articles/google-url-shorening-api

Each install of the plugin would then require an API Key... but they are free.
Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au