履歴: ソフトウェア/pukiwiki/QRコードの表示
各行は、その日時に書かれた内容です。追加・削除は、1 つ前の版との行数の差です (全 6 版)。「差分」は比較する版、「基準」は比べる相手の版を選びます
| 日時 | タイトル | 文字数 | 追加 | 削除 | 内容 | 差分 | 基準 |
|---|---|---|---|---|---|---|---|
| 2024/4/22 20:07:23 | ソフトウェア/pukiwiki/QRコードの表示 最新版 | 10,783 | +1 | -1 | 表示 | 差分 | — |
| 2024/4/22 20:07:23 | ソフトウェア/pukiwiki/QRコードの表示 | 10,789 | +93 | -1 | 表示 | 表示中 | 選択 |
| 2015/6/18 8:55:49 | ソフトウェア/pukiwiki/QRコードの表示 | 7,773 | +2 | -1 | 表示 | 差分 | 基準 |
| 2015/6/18 8:55:49 | ソフトウェア/pukiwiki/QRコードの表示 | 7,772 | +8 | -7 | 表示 | 差分 | 選択 |
| 2015/6/18 8:55:49 | ソフトウェア/pukiwiki/QRコードの表示 | 7,765 | +284 | -4 | 表示 | 差分 | 選択 |
| 2015/6/18 7:43:29 | ソフトウェア/pukiwiki/QRコードの表示 | 311 | — | — | 表示 | — | 選択 |
基準: ソフトウェア/pukiwiki/QRコードの表示 (2015/6/18 8:55:49) → 比較: ソフトウェア/pukiwiki/QRコードの表示 (2024/4/22 20:07:23)
@@ -291,7 +291,99 @@
めでたしめでたし。
+* Bitly API v4 への対応 [#q8c834f7]
+
+- Bitly にログインして Settings から API を選択
+- Access Token の項目で Enter Password のフィールドにパスワードを入れて Generate token する
+- 生成された token をコピーしておく
+
+https://www.meganii.com/blog/2020/04/17/bitly-api-migrating-from-v3/ や
+https://qiita.com/re-24/items/bfdd533e5dacecd21a7a#post%E3%83%A1%E3%82%BD%E3%83%83%E3%83%89%E3%81%AE%E5%AE%9F%E8%A1%8C などを参考に、
+
+ LANG: php
+ function shorten_url($url)
+ {
+ $access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
+
+ $api_url = 'https://api-ssl.bitly.com/v4/shorten';
+ $header = [
+ 'Authorization: Bearer ' . $access_token,
+ 'Content-Type: application/json',
+ ];
+ $data = [
+ 'long_url'=> $url,
+ ];
+
+ $curl = curl_init($api_url);
+ curl_setopt($curl, CURLOPT_POST, TRUE); //POSTで送信
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // リクエストにヘッダーを含める
+ curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); //データをセット
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); //受け取ったデータを変数に
+ $result = json_decode( curl_exec( $curl ), true );
+
+ return $result['data']['url'];
+ }
+
+* Google Chart API が廃止になったことへの対応 [#u5b9aba1]
+
+https://intercord.jp/blog/2024415google-chart-api/ によれば、
+
+ http://chart.apis.google.com/chart?chs=500x500&cht=qr&chl=(URL)
+
+の代わりに
+
+ https://api.qrserver.com/v1/create-qr-code/?data=(URL)
+
+とすれば良いそうなのですが・・・
+
+- 生成に時間がかかる
+- QR コードのバージョンを指定できない
+
+という問題があるのでちょっと使いづらいです。。。
+
+* qrcode.js を使ってブラウザ上で生成する [#m38e0049]
+
+https://github.com/davidshimjs/qrcodejs
+
+こちらを利用すると javascript を使ってブラウザ上で QR コードを生成可能になります。
+
+ただこのコード 2024/04 次点で9年前から更新されておらず、pull request がたんまり溜まっていました。
+
+- Android 端末でのバージョンチェックに関するバグ
+- ユニコード対応部分のバグ
+- SVG をダークカラーで使う際のエッジ処理
+- 同じ要素に繰り返し生成する際の初期化処理
+- Drawing.clear() で画像を非表示
+- QRCodeLimitLength の数え間違い
+
+
+あたりに対応するため
+
+- https://github.com/davidshimjs/qrcodejs/pull/273/files
+- https://github.com/davidshimjs/qrcodejs/pull/170/files
+- https://github.com/davidshimjs/qrcodejs/pull/137/files
+- https://github.com/davidshimjs/qrcodejs/pull/82/files
+- https://github.com/davidshimjs/qrcodejs/pull/248/files
+- https://github.com/davidshimjs/qrcodejs/pull/258/files
+- https://github.com/davidshimjs/qrcodejs/pull/31/files
+- https://github.com/davidshimjs/qrcodejs/pull/74/files
+
+を取り込み、また、生成する画像サイズをコンテナとなる div 要素に合わせるため
+
+ LANG: js
+ this._elImage.style.width = "100%"; // added by osamu@big.jp
+ this._elImage.style.height = "100%"; // added by osamu@big.jp
+
+を追加したのが https://dora.bk.tsukuba.ac.jp/~takeuchi/qrcode.js になります。
+
+ LANG: php
+ $id = uniqid();
+ list($width, $height)=explode("x", $chs);
+ list($level, $typeNumber)=explode("|", $chld);
+ return '<span id="'.$id.'" style="display: inline-block; width: '.$width.'px; height: '.$height.'px; border: 8px solid white;"'.$class.'></span><script lang="javascript">{ new QRCode("'.$id.'", {text: "'.$str.'", width: '.($width*10).', height: '.($height*10).', typeNumber: '.$typeNumber.', correctLevel: QRCode.CorrectLevel.'.$level.'}); }</script>';
+
+とすることで QR コードを表示できるようになりました。
+
* コメント・質問 [#icbe13bd]
#article_kcaptcha
-