Automatic QR instead of cover image.

Started by JorgeAnzola, 11 April 2015, 18:57:47

Previous topic - Next topic
A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

JorgeAnzola

That would be very cool. I'm trying to do that with goqr.me API, wich creates a QR with a given URL. I'm trying to get current URL and put in a <img> tag. And put the code here

<div class="cover<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<!-- here -->

    Automatic generated <img> code

<!-- here -->
                </div>


I haven't make it because I'm not that good in PHP programming. Here's the Stackover post with the codes I've used.

Any help would be appreciated.

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

JorgeAnzola

I haven't made***
Sorry for any other misspelling.

federica

Hi JorgeAnzola,
if you need to get the current url I suggest to see this guide http://webcheatsheet.com/php/get_current_page_url.php
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]

JorgeAnzola

Hi! I made it. If anyone else is interested, I put this:

<?php 
function getUrl() { 
    
$url1  = @( $_SERVER["HTTPS"] != 'on' ) ? ''.$_SERVER["SERVER_NAME"] :  ''.$_SERVER["SERVER_NAME"]; 
    
$url1 .= $_SERVER["REQUEST_URI"]; 
    return 
$url1;

?>

<center>
<img src="http://api.qrserver.com/v1/create-qr-code/?size=70x70&data=<?= getUrl(); ?> ">
<a href="http://api.qrserver.com/v1/create-qr-code/?size=600x600&data=<?= getUrl(); ?>">Descargar código QR</a>
</center>


in here


<h2><?php echo $this->book->title;?></h2>
<h4><?php echo $this->book->subtitle;?></h4>
<div class="booktab<?php echo $this->escape($pageClass); ?>">
<div class="cover<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<!-- FROM HERE -->

<?php 
function getUrl() { 
    
$url1  = @( $_SERVER["HTTPS"] != 'on' ) ? ''.$_SERVER["SERVER_NAME"] :  ''.$_SERVER["SERVER_NAME"]; 
    
$url1 .= $_SERVER["REQUEST_URI"]; 
    return 
$url1;

?>

<center>
<img src="http://api.qrserver.com/v1/create-qr-code/?size=70x70&data=<?= getUrl(); ?> ">
<a href="http://api.qrserver.com/v1/create-qr-code/?size=600x600&data=<?= getUrl(); ?>">Descargar código QR</a>
</center>
<!-- TO HERE -->
                </div>


In the file components/com_abook/views/book/tmpl/default.php. BUT friendly URLs have to be activated.

A financial contribution is greatly appreciated as a support, to help us to keep live the project.
If you like this project you can donate some piece of BitCoin to this address: bc1qy5tgq6tvrckac2a57unxvqcnxamrvhduve9sj9

federica

Instead of getUrl() you could try to use the function you can see here http://webcheatsheet.com/php/get_current_page_url.php
Your function is not complete, for these reason is working only the SEF is enabled
Al mondo ci sono 10 tipi di persone, quelli che hanno capito il codice binario e quelli che non l'hanno capito.
Informatizzati [url="https://informatizzati.org"]https://informatizzati.org[/url]
Stacca la spina [url="https://disconnessi.org"]https://disconnessi.org[/url]