diff --git a/html_generator.php b/html_generator.php index ee8a5b9..a52c228 100644 --- a/html_generator.php +++ b/html_generator.php @@ -28,6 +28,9 @@ * Token + shortened pubkey | Name | Description | Users | View Links(?) | Join URL */ function get_table_html($info_arrays) { +// $jl = "http://116.203.217.101/feels?public_key=2054fa3271f27ec9e55492c85d022f9582cb4aa2f457e4b885147fb913b9c131"; +// $img_tag = get_qr_img_tag_from_join_url($jl); + $table_lines = array(); foreach($info_arrays as $id => $content) { /* @@ -54,9 +57,7 @@ " " . $content["description"] . "" . PHP_EOL . " " . $content["active_users"] . "" . PHP_EOL . " " . $content["preview_link"] . "" . PHP_EOL . - /*" " . substr($content["join_link"], 0, 32) . "..." . PHP_EOL . - " " . PHP_EOL . - " " . PHP_EOL .*/ +// " " . PHP_EOL; " " . $content["join_link"] . "" . PHP_EOL . " " . PHP_EOL; $table_lines[] = $line; @@ -73,6 +74,7 @@ " Description" . PHP_EOL . " Users" . PHP_EOL . " Preview" . PHP_EOL . +// " QR" . PHP_EOL . " Join URL" . PHP_EOL . " " . PHP_EOL; @@ -97,4 +99,29 @@ return $html; } + + function get_qr_img_tag_from_join_url($join_url) { + $data = get_base64_qr_code_from_join_url($join_url); + $mime = "image/png"; + $src = "data: " . $mime . ";base64," . $data; + + $result = ""; +// echo($result . PHP_EOL); + return $result; + } + + function get_base64_qr_code_from_join_url($join_url) { + // https://developers.google.com/chart/infographics/docs/qr_codes + $data = urlencode($join_url); + $size = "512x512"; + //$error_correction_level = ""; // "chld=" L = 7%, M = 15%, Q = 25%, H = 30% + $api_url = + "https://chart.googleapis.com/chart?cht=qr" . + "&chs=" . $size . + "&chl=" . $data; + $img_base64 = base64_encode(file_get_contents($api_url)); +// echo($img_base64 . PHP_EOL); + + return $img_base64; + } ?>