Extension talk:QrCode

Please use the [ Add Topic] link above to add a new issue.

Also, please enable debugging in your LocalSetting.php file like so:

and then grep what is being added to that log and has QrCode in hit: i.e.

~ # tail -f /tmp/wiki.log | grep QrCode

Supply that information when you report problems. Thanks!

Class Job not found
I am getting the following error on using this extension on my MediaWiki 1.12 version:

Fatal error: Class 'Job' not found in /var/lib/mediawiki/extensions/QrCode/QrCode.php on line 162

The requirement does say 1.12 or above so it should have worked...Any ideas?

--Modest 16081982 22:44, 27 October 2010 (UTC)


 * I'm not sure when exactly the Job class was introduced, but from what I can judge, it has been in mw 1.6. Thus it should work with 1.12.

Can you check whether you have the /includes/JobQueue.php file? --Kwisatz

Never mind. I just upgraded to 1.15 and now will test it with it.--Modest 16081982 06:19, 13 December 2010 (UTC)

MW1.16 : Call to a member function addWikiText
Hi,

when saving page, I get following message in the apache logfile : PHP Fatal error: Call to a member function addWikiText on a non-object in /server/www/trunk/mediawiki/extensions/QrCode/QrCode.php on line 191

and following in the browser : Detected bug in an extension! Hook fnAddToWatch failed to return a value; should return true to continue hook processing or false to abort. Backtrace:
 * 1) 0 /server/www/trunk/mediawiki/includes/Article.php(2099): wfRunHooks('ArticleSaveComp...', Array)
 * 2) 1 /server/www/trunk/mediawiki/includes/Article.php(1791): Article->doEdit(MediaWiki wu...', '', 98)
 * 3) 2 /server/www/trunk/mediawiki/includes/EditPage.php(1047): Article->updateArticle(MediaWiki wu...', , false, false, false, )
 * 4) 3 /server/www/trunk/mediawiki/includes/EditPage.php(2552): EditPage->internalAttemptSave(false, false)
 * 5) 4 /server/www/trunk/mediawiki/includes/EditPage.php(389): EditPage->attemptSave
 * 6) 5 /server/www/trunk/mediawiki/includes/EditPage.php(271): EditPage->edit
 * 7) 6 /server/www/trunk/mediawiki/includes/Wiki.php(553): EditPage->submit
 * 8) 7 /server/www/trunk/mediawiki/includes/Wiki.php(70): MediaWiki->performAction(Object(OutputPage), Object(Article), Object(Title), Object(User), Object(WebRequest))
 * 9) 8 /server/www/trunk/mediawiki/index.php(117): MediaWiki->performRequestForTitle(Object(Title), Object(Article), Object(OutputPage), Object(User), Object(WebRequest))
 * 10) 9 {main}

Any idea what's going on ? Adding a global $wgOut didn't help

Thanks


 * I'm not sure that is related to the QrCode extension. It doesn't use the mentioned fnAddToWatch hook. Maybe you have another extension that does not return a value? --Clausekwis 11:41, 23 February 2011 (UTC)

Use another URL
unfortunately label parameter gets sanitized. To specify an URL, code needs to be changed like this : public function showCode( $label = false ){ // Check for a provided label and use the page URL as default. // Also strip all non-alphanumeric characters if ( $label ) { if(eregi('^(http|https)://',$label)) { $this->_label = $label; } else { $this->_label = preg_replace("/[^0-9a-zA-Z_]+/", "", $label); } 			$this->_uploadComment = $label;	// should we sanitize this?


 * I have removed all sanitizing from the label as I don't exactly remember where I saw a problem with this. It is probably a remainder from before the md5ing of the filename. --Clausekwis 12:27, 23 February 2011 (UTC)

Not working with MW1.15.5 also
I added the following wikitext in one of my pages on my Mediawiki version 1.15 on my Debian Lenny system: {#qrcode:}} This is Test Page 2 and I get the following warning messages at the top of the page with NO QR Code image generated: Warning: file_put_contents(/usr/share/mediawiki-extensions/QrCode/phpqrcode/qrcode7AaP9U-errors.txt) function.file-put-contents: failed to open stream: Permission denied in /usr/share/mediawiki-extensions/QrCode/phpqrcode/qrtools.php on line 106 Also there is specific version of QRCode that I should be using with MW1.15? --Modest 16081982 06:23, 13 December 2010 (UTC)


 * Have you checked that your webserver has write permissions on the folder mentioned in your above error message? i.e. /usr/share/mediawiki-extensions/QrCode/phpqrcode/ --Clausekwis 11:33, 23 February 2011 (UTC)
 * Also please try the latest revision of the extension as the location for logfiles has changed. --Clausekwis 12:51, 23 February 2011 (UTC)

QrCodes not placed on page?
It seems that the QrCodes on my pages are created, as i can see in my FTP program. The issue is that they don't appear on the page itself. I wrote a template for it, that worked a while for me. There are some pages that have the codes on the pages itself. The new created pages have the same template and the QrCode isn't showing up while it is created. Any idea?

What are the required folders on the server for this extension to have it worked and what CHMODS are required to those folders?


 * Can you please enable debugging in your LocalSettings.php file and grep for anything containing 'QrCode'?
 * Successful creation of a qrcode looks like this:

QrCode::_generate: Generated qrcode file /tmp/qrcodeqfiBWc with ecc M, 4 and boundary 0. DatabaseBase::query: Writes done: INSERT INTO `job` (job_id,job_cmd,job_namespace,job_title,job_params) VALUES (NULL,'uploadQrCode','2','Kwisatz/Sandbox','a:3:{s:7:\"tmpName\";s:17:\"/tmp/qrcodeqfiBWc\";s:7:\"dstName\";s:39:\"QR-dc4e51355bfcfe33e689f1c30e0b1f17.png\";s:7:\"comment\";s:25:\"http://www.hackerspace.lu\";}') QrCodeJob::run: Uploading qrcode, c: http://www.hackerspace.lu t: QrCode QR-dc4e51355bfcfe33e689f1c30e0b1f17.png, generated on Wed, 23 Feb 2011 13:41:50 +0100 by the QrCode Extension for page User:Kwisatz/Sandbox. \performUpload: sum:http://www.hackerspace.lu c: QrCode QR-dc4e51355bfcfe33e689f1c30e0b1f17.png, generated on Wed, 23 Feb 2011 13:41:50 +0100 by the QrCode Extension for page User:Kwisatz/Sandbox. w:FSRepo::publishBatch: wrote tempfile /tmp/qrcodeqfiBWc to /var/www/hackerspace.lu/www/w/images/6/68/QR-dc4e51355bfcfe33e689f1c30e0b1f17.png uploadQrCode User:Kwisatz/Sandbox tmpName=/tmp/qrcodeqfiBWc dstName=QR-dc4e51355bfcfe33e689f1c30e0b1f17.png comment=http://www.hackerspace.lu


 * Hereby i can add some of the code, it's placed here for as long as needed: http://dpaste.org/kOFv/

1.17
Is anyone working on making this work for 1.17? rotsee 20:33, 11 July 2011 (UTC)


 * Yes, we're currently working on it and will commit to subversion as soon as we have completed all of our tests. --Clausekwis 08:01, 12 July 2011 (UTC)


 * That's beautiful, thanks! rotsee 11:23, 26 July 2011 (UTC)

A solution for 1.17.0
This is a quick solution for those who has downloaded a version of this extension and want to make work on MediaWiki 1.17.0

On file QrCode.php fun method UploadQrCodeJob::run you may replace this piece of code: By something like this: --Daemonraco 16:54, 15 August 2011 (UTC)


 * Did someone get this to work on 1.17? For me, instead of an image, the digit "1" shows up...


 * Never mind, I was using version 0.08, downloaded 0.09 from trunk now, an it works like a charm! rotsee 19:15, 26 September 2011 (UTC)

Tweaks
First tweak I present is base on something posted avobe. I just added the keyword url to make a difference between a simple label and an URL.

The second tweak I present is the addition of keyword isize to resize a thumbnail. Even though there's a keyword called size, this affects directly the image generation and not the size of a thumbnail. In my case, I rather create an image of 500px and then I show it with different sizes use the MediaWiki auto-thumb functionality (visit Help:Images for more information).

The problem I had was to create a big enough QrCode image and not been able to show it in 200x200 pixels.

Search and Replace (Implementation)
Search: Replace: Search: Replace: Search: Replace: Search: Replace: Search: Replace: Search: Replace:

Usage
For the image tweak, you may write something like this For the URL tweak, you may write something like this --Daemonraco 02:52, 17 August 2011 (UTC)

QrCode in Sidebar
If you wish to have a QrCode for each page of you wiki you may do this (if you need an example you may visit my personal wiki and see this tweak working).

--Daemonraco 01:18, 19 August 2011 (UTC)

First: Font Code
The first thing is to add a little code creating a file called $IP/extensions/QrCode/QrCodeSidebar.php and filling it with:

Second: Activating It
Now you need to modify you LocalSettings.php and add these lines at the end (or wherever you see fit):

Note
This will add a QrCode to each page except those under a namespace. This is made in this way to avoid cyclic image creations.

Make QR image non clickable?
Hi.

Great extension, but I have one issue. The actual QR image is clickable which then takes you to the image page. What would be nice is if the MW equivalent to link= could be implemented so the image just shows without a clickable link. It is after all a camera oriented image rather than one you click!

--Mitchelln 10:21, 27 September 2011 (UTC)