rabin 5 anni fa
parent
commit
e15acb5e9f
2 ha cambiato i file con 31 aggiunte e 1 eliminazioni
  1. 2 0
      assets/layadmin/html/inc/script.html
  2. 29 1
      src/Lib/Input.php

+ 2 - 0
assets/layadmin/html/inc/script.html

@@ -45,5 +45,7 @@
 
 <script type="text/javascript" src="../script/lib/clipboard/clipboard.js"></script>
 
+<script type="text/javascript" src="../script/lib/pic/holder.js"></script>
+
 <!-- 加载主要js,很乱,后续优化 -->
 <script type="text/javascript" src="../script/lib/manage/main.js?v32"></script>

+ 29 - 1
src/Lib/Input.php

@@ -258,7 +258,35 @@ class Input
 
         if (isset($param['place']) && $param['place']) {
             //$pic = 'src="http://placehold.it/' . $param['place'] . '"';
-            $param['placeimg'] = '<img src="http://temp.im/' . $param['place'] . '" class="place" width="150" />';
+            //$param['placeimg'] = '<img src="http://temp.im/' . $param['place'] . '" class="place" width="150" />';
+            $place = $param['place'];
+
+            $default = '';
+
+            if (strstr($param['place'], '?')) {
+                $temp = explode('?', $param['place']);
+                $param['place'] = $temp[0];
+                $default .= '&';
+            } else {
+                $default .= '?';
+            }
+
+            if (strstr($place, '*')) {
+                $place = str_replace('*', 'x', $place);
+            } elseif (strstr($place, 'X')) {
+                $place = str_replace('X', 'x', $place);
+            } else {
+                $place = $param['place'] . 'x' . $param['place'];
+            }
+
+            $text = '';
+            //$text = "" . $place . "px \n 大小不能超过2M";
+            //$text = "图片尺寸".$place."px \n 也可以上传等比尺寸 \n 上传大小不能超过2M \n 支持JPG、PNG、 GIF格式";
+            
+            //$default .= 'auto=yes&theme=social&text=' . $text;
+            $default .= 'auto=yes&text=' . $text;
+            $place .= $default;
+            $param['placeimg'] = '<img src="holder.js/' . $place . '" class="place" style="width:150px" onclick="$(this).parent().parent().find(\'.image_upload\').click()"/>';
         } else {
             $param['place'] = '';
             $param['placeimg'] = '';