visuddhinanda vor 10 Monaten
Ursprung
Commit
36eeeb314f

+ 56 - 0
api-v8/app/Console/Commands/CreateMyHanCrop.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class CreateMyHanCrop extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'command:name';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        $csvFile = config("mint.path.dict_text") . '/zh/my-han/index.csv';
+        if (($fp = fopen($csvFile, "r")) !== false) {
+            $row = 0;
+            $page = 0;
+            while (($data = fgetcsv($fp, 0, ',')) !== false) {
+                if ($row === 0) {
+                    continue;
+                }
+                $page = $data[1];
+                $word = $data[2];
+                $row++;
+            }
+            fclose($fp);
+        }
+        return 0;
+    }
+}

+ 43 - 0
api-v8/resources/mustache/my_han_crop.tpl

@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+	<head>
+    <style type="text/css">
+.img{
+	max-height: 1000px;
+    max-width: 750px;
+    overflow: hidden;
+	padding: 0 8px 8px 0;
+}
+.img:hover{
+	overflow: scroll;
+	scrollbar-width: thin;
+	scrollbar-color: rgba(0, 0, 0, 0.5) transparent;
+}
+.dict{
+	width: 880px;
+}
+	</style>
+</head>
+  <body>
+    <h3>Page {{page}}</h3>
+<div style="display: flex;">
+<div>
+	<table>
+{{#words}}
+      <tr>
+        <td>{{spell}}</td>
+        <td><img src="img/{{spell}}.png" /></td>
+      </tr>
+{{/words}}
+    </table>
+</div>
+<div>
+{{#dict}}
+<div class="img">
+	<img class="dict" src="{{img}}">
+</div>
+{{/dict}}
+</div>
+</div>
+  </body>
+</html>