Page 1 of 2
QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 19:36
by Old Boy
Seit ewigen Zeiten hatte ich das Script nicht mehr verwendet. Jetzt aber habe mal wieder damit experimentieren wollen und stelle fest, es wird kein Image angezeigt.
Hat sich da ggf. etwas geändert, von dem ich oder das Script nichts weiss?
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 19:46
by update
habe vor zwei Wochen so einen QR_Code eingebaut und kann sagen: rennt:
Code: Select all
<div class="qrcode">{QR_CODE240}</div>
Muss natürlich das Script in FE-Render rein...
Ach ja: phpwcms 1.7.5 (2014/10/02, r538)
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 19:53
by Old Boy
Komisch... welches Script hast du denn verwendet?
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 20:07
by update
Das hier:
Code: Select all
<?php
// ----------------------------------------------------------------
// simple current url qr-code generator
// TAG {QR_CODE}, {QR_CODE 200}, {QR_CODE175}
// e.g. 200 or 175 are the dimensions of the image
//
// OG (Oliver Georgi): 16.02.2012
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// ----------------------------------------------------------------
if(preg_match('/\{QR_CODE(.*?)\}/', $content['all'], $qr_code)) {
$qr_code['size'] = abs(intval(trim($qr_code[1])));
if(empty($qr_code['size'])) {
$qr_code['size'] = 150; // default size
}
$qr_code['url'] = rawurlencode( abs_url(array(),array(),'','') );
$content['all'] = str_replace(
$qr_code[0],
'<img src="http://chart.apis.google.com/chart?cht=qr&chl='.$qr_code['url'].'&chs='.$qr_code['size'].'x'.$qr_code['size'].'" alt="QR Direct Link" />',
$content['all']
);
}
?>
Das alt="QR Direct Link" könnte noch optimiert werden...
Edit: ist aus dem
wiki
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 20:12
by Old Boy
Komisch... das hatte ich doch auch im render Ordner????
Na, werd' ich's halt noch mal rein packen und sehen, ob's dann funktioniert?
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 20:24
by update
habs erweitert für den Artikeltitel in der ALT-Beschreibung, sollte gehen:
Code: Select all
<?php
// ----------------------------------------------------------------
// simple current url qr-code generator
// TAG {QR_CODE}, {QR_CODE 200}, {QR_CODE175}
// e.g. 200 or 175 are the dimensions of the image
//
// OG (Oliver Georgi): 16.02.2012
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// ----------------------------------------------------------------
if(preg_match('/\{QR_CODE(.*?)\}/', $content['all'], $qr_code)) {
$qr_code['size'] = abs(intval(trim($qr_code[1])));
if(empty($qr_code['size'])) {
$qr_code['size'] = 150; // default size
}
$qr_code['url'] = rawurlencode( abs_url(array(),array(),'','') );
$content['all'] = str_replace(
$qr_code[0],
'<img src="http://chart.apis.google.com/chart?cht=qr&chl='.$qr_code['url'].'&chs='.$qr_code['size'].'x'.$qr_code['size'].'" alt="{ARTICLE_TITLE}" />',
$content['all']
);
}
if( ! (strpos($content["all"],'{ARTICLE_')===false)) {
// {ARTICLE_TITLE} -> ARTICLE_TITLE replacement
// -----------------------------------------------------
if( ! (strpos($content["all"],'{ARTICLE_TITLE}')===false)) {
$content["all"] = str_replace('{ARTICLE_TITLE}', $content['article_title'], $content["all"]);
}
}
?>
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 20:49
by Old Boy
Dein Script hat
leider nicht funktioniert
Ich hatte es jetzt folgendermassen gemacht ... und es
hat funktioniert
Code: Select all
<?php
// ----------------------------------------------------------------
// simple current url qr-code generator
// TAG {QR_CODE}, {QR_CODE 200}, {QR_CODE175}
// e.g. 200 or 175 are the dimensions of the image
//
// OG (Oliver Georgi): 16.02.2012
// ----------------------------------------------------------------
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// ----------------------------------------------------------------
if(preg_match('/\{QR_CODE(.*?)\}/', $content['all'], $qr_code)) {
$qr_code['size'] = abs(intval(trim($qr_code[1])));
if(empty($qr_code['size'])) {
$qr_code['size'] = 150; // default size
}
$qr_code['url'] = rawurlencode( abs_url(array(),array(),'','') );
$content['all'] = str_replace(
$qr_code[0],
'<img src="https://chart.googleapis.com/chart?chs='.$qr_code['size'].'x'.$qr_code['size'].'&cht=qr&chl='.$qr_code['url'].'" />',
$content['all']
);
}
?>
Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 22:43
by update
Der Code funktioniert hier. Ist vielleicht nicht die feine Art, aber...
Aber gut, wenn Du jetzt, mit diesem Schubs, Erfolg hattest

Re: QR-Code zeigt kein img mehr an !?
Posted: Fri 28. Nov 2014, 23:12
by Old Boy
Mensch claus... was sind wir zwei super "Fachleute"...
Keine Ahnung von PHP, aber "La Paloma" pfeifen

Re: QR-Code zeigt kein img mehr an !?
Posted: Sat 29. Nov 2014, 12:06
by update
WOLLJA!

Re: QR-Code zeigt kein img mehr an !?
Posted: Sat 10. Jan 2015, 15:36
by nameless1
Old Boy wrote:
Ich hatte es jetzt folgendermassen gemacht ... und es
hat funktioniert
google hat die api angepasst. kannst du das bitte gleich ins wiki heben. das dort befindliche script funktioniert ja nur noch suboptimal.
Re: QR-Code zeigt kein img mehr an !?
Posted: Sat 10. Jan 2015, 19:42
by update
nameless1 wrote:kannst du das bitte gleich ins wiki heben
den code von OldBoy?
Re: QR-Code zeigt kein img mehr an !?
Posted: Sun 11. Jan 2015, 09:20
by update
hab mal angenommen, dass Du das meintest und das wiki aktualisiert (en + de)
Re: QR-Code zeigt kein img mehr an !?
Posted: Sun 11. Jan 2015, 15:32
by nameless1
danke.
bin gerade ein bisschen unsicher ob die api von google komplett depreceated ist?!? dann sollten wir das auch so ins wiki schreiben.
Re: QR-Code zeigt kein img mehr an !?
Posted: Sun 11. Jan 2015, 16:25
by juergen
Sie hat noch 3 Monate !
Google will announce if it intends to discontinue or make backwards incompatible changes to this API or Service. Google will use commercially reasonable efforts to continue to operate those Google Chart Tools versions and features identified at
http://developers.google.com/chart/chart-api-list without these changes until April 20, 2015, unless (as Google determines in its reasonable good faith judgment):
required by law or third party relationship (including if there is a change in applicable law or relationship), or
doing so could create a security risk or substantial economic or material technical burden.
The above policy is the "Deprecation Policy."
After April 20, 2015, this Deprecation Policy will not apply.
Das erinnert mich an:
Wenn der Hahn kräht auf dem Mist, ändert sich das Wetter oder es bleibt wies' ist
