Subversion Repositories php-qbpwcf

Rev

Rev 173 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
/*
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
7
 
8
    This file is part of QBPWCF.
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
12
    the Free Software Foundation, either version 3 of the License, or
13
    (at your option) any later version.
14
 
15
    QBPWCF is distributed in the hope that it will be useful,
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
    GNU General Public License for more details.
19
 
20
    You should have received a copy of the GNU General Public License
21
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.
22
 
23
*/
24
namespace qbpwcf;
25
 
26
/*
27
類別說明:
28
跟圖片處理有關的類別/
29
備註:
30
無.
31
*/
32
class img{
33
 
34
	/*
35
	#函式說明:
36
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
37
	#回傳結果:
38
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
39
	#$reuslt["error"],執行不正常結束的錯訊息陣列.
40
	#$result["function"],當前執行的函式名稱.
41
	#必填參數:
42
	#$method,物件,為物件實體或類別名稱,會自動置入該參數.
43
	#$arguments,陣列,為呼叫方法時所用的參數.
44
	#參考資料:
45
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
46
	*/
47
	public function __call($method,$arguments){
48
 
49
		#取得當前執行的函式
50
		$result["function"]=__FUNCTION__;
51
 
52
		#設置執行不正常
53
		$result["status"]="false";
54
 
55
		#設置執行錯誤
56
		$result["error"][]=__NAMESPACE__ ."/".$method."() 不存在!";
57
 
58
		#設置所丟入的參數
59
		$result["error"][]=$arguments;
60
 
61
		#回傳結果
62
		return $result;
63
 
64
		}#function __call end
65
 
66
	/*
67
	#函式說明:
68
	#當前類別被呼叫的靜態方法不存在時,將會執行該函數,回報該方法不存在.
69
	#回傳結果:
70
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
71
	#$reuslt["error"],執行不正常結束的錯訊息陣列.
72
	#$result["function"],當前執行的函式名稱.
73
	#必填參數:
74
	#$method,物件,為物件實體或類別名稱,會自動置入該參數.
75
	#$arguments,陣列,為呼叫方法時所用的參數.
76
	#參考資料:
77
	#__call=>http://php.net/manual/en/language.oop5.overloading.php#object.callstatic
78
	*/
79
	public static function __callStatic($method,$arguments){
80
 
81
		#取得當前執行的函式
82
		$result["function"]=__FUNCTION__;
83
 
84
		#設置執行不正常
85
		$result["status"]="false";
86
 
87
		#設置執行錯誤
88
		$result["error"][]="欲呼叫的". __NAMESPACE__ ."/".$method."() 不存在!";
89
 
90
		#設置所丟入的參數
91
		$result["error"][]=$arguments;
92
 
93
		#回傳結果
94
		return $result;
95
 
96
		}#function __callStatic end
97
 
98
	/*
99
	#函式說明:
100
	#放置可以套用css樣式的圖片
101
	#回傳結果:
102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
103
	#$result["error"],錯誤訊息陣列
104
	#$result["function"],當前函數執行的名稱
105
	#$result["content"],印出圖片的語法。		
106
	#必填參數:
107
	$conf["position"]="";#圖片位置
108
	#可省略參數:
109
	#$conf["id"]="";#圖片的id,沒有就不設定.
110
	#$conf["alt"]="";#若沒有圖片要用什麼文字顯示。
111
	#$conf["class"]="";#要套用的css樣式類別名稱。
112
	#參考資料:
113
	#無.
114
	#備註:
115
	#無.
116
	*/	
117
	public static function show(&$conf){
118
 
119
		#初始化要回傳的變數
120
		$result=array();
121
 
122
		#記錄當前執行的函數名稱
123
		$result["function"]=__FUNCTION__;
124
 
125
		#如果 $conf 不為陣列
126
		if(gettype($conf)!="array"){
127
 
128
			#設置執行失敗
129
			$result["status"]="false";
130
 
131
			#設置執行錯誤訊息
132
			$result["error"][]="\$conf變數須為陣列形態";
133
 
134
			#如果傳入的參數為 null
135
			if($conf==null){
136
 
137
				#設置執行錯誤訊息
138
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
139
 
140
				}#if end
141
 
142
			#回傳結果
143
			return $result;
144
 
145
			}#if end
146
 
147
		#檢查參數
148
		#函式說明:
149
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
150
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
151
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
152
		#$result["function"],當前執行的函式名稱.
153
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
154
		#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
155
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
156
		#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
157
		#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
158
		#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
159
		#$result["notNeedVar"],字串陣列,多餘的參數名稱.
160
		#必填寫的參數:
161
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
162
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
163
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
164
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("position");
165
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
166
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string");
167
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
168
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
169
		#可以省略的參數:
170
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
171
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
172
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
173
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("id","alt","class");
174
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
175
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","string","string");
176
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
177
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,"","");
178
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
179
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
180
		#參考資料來源:
181
		#array_keys=>http://php.net/manual/en/function.array-keys.php
182
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
183
		unset($conf["variableCheck::checkArguments"]);
184
 
185
		#如果檢查失敗
186
		if($checkResult["status"]=="false"){
187
 
188
			#設置錯誤狀態
189
			$result["status"]="false";
190
 
191
			#設置錯誤提示
192
			$result["error"]=$checkResult;
193
 
194
			#回傳結果
195
			return $result;
196
 
197
			}#if end
198
 
199
		#如果檢查不通過
200
		if($checkResult["passed"]=="false"){
201
 
202
			#設置錯誤狀態
203
			$result["status"]="false";
204
 
205
			#設置錯誤提示
206
			$result["error"]=$checkResult;
207
 
208
			#回傳結果
209
			return $result;
210
 
211
			}#if end
212
 
213
		#如果$conf["class"]不為""
214
		if($conf["class"]!=""){
215
 
216
			#則套用css樣式。
217
			$conf["class"] = "class = \"".$conf["class"]."\"";
218
 
219
			}#if end
220
 
221
		#如果$conf["alt"]不為""
222
		if($conf["alt"]!=""){
223
 
224
			$conf["alt"]="alt=\"".$conf["alt"]."\"";
225
 
226
			}#else end
227
 
228
		#初始化 id 的內容
229
		$id="";
230
 
231
		#如果有設定 id
232
		if(isset($conf["id"])){
233
 
234
			#設置id.
235
			$id="id='".$conf["id"]."'";
236
 
237
			}#if end
238
 
239
		#回傳放置圖片的語法
240
		$result["content"]="<img src = \"".$conf["position"]."\" ".$conf["alt"]." ".$conf["class"]." ".$id.">";
241
 
242
		#設置執行正常
243
		$result["status"]="true";
244
 
245
		#回傳結果
246
		return $result;
247
 
248
		}#function showClassImg end
249
 
250
	/*
251
	#函式說明:
252
	#使用在用戶端的圖片插入到網頁裡面,用戶端要有提供類似apache的功能,這樣才能存取用戶端的圖片。
253
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
254
	#$result["error"],錯誤訊息陣列
255
	#$result["function"],當前函數執行的名稱
256
	#$result["content"],印出圖片的語法。		
257
	#必填參數:
258
	$conf["AbsoluteFilePosition"]="";#去掉開頭(127.0.0.1或localhost)的檔案在本機的絕對位置。
259
	#可省略參數:
260
	#$conf["method"]="";#通訊協定名稱,預設爲"http"
261
	#$conf["port"]="";#存取用戶端檔案時的port
262
	#$conf["width"]="";#圖片的顯示寬度
263
	#$conf["height"]="";#圖片的顯示高度
264
	#$conf["alt"]="";#若圖片無法顯現則用 $alt 文字替代
265
	#參考資料:
266
	#無.
267
	#備註:
268
	#無.
269
	*/
270
	public static function showLocal($conf){
271
 
272
		#初始化要回傳的變數
273
		$result=array();
274
 
275
		#記錄當前執行的函數名稱
276
		$result["function"]=__FUNCTION__;
277
 
278
		#如果 $conf 不為陣列
279
		if(gettype($conf)!="array"){
280
 
281
			#設置執行失敗
282
			$result["status"]="false";
283
 
284
			#設置執行錯誤訊息
285
			$result["error"][]="\$conf變數須為陣列形態";
286
 
287
			#如果傳入的參數為 null
288
			if($conf==null){
289
 
290
				#設置執行錯誤訊息
291
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
292
 
293
				}#if end
294
 
295
			#回傳結果
296
			return $result;
297
 
298
			}#if end
299
 
300
		#如果 $conf["AbsoluteFilePosition"] 沒有設定
301
		if(!isset($conf["AbsoluteFilePosition"])){
302
 
303
			#設置執行失敗
304
			$result["status"]="false";
305
 
306
			#設置執行錯誤訊息
307
			$result["error"][]="\$conf[\"AbsoluteFilePosition\"]參數沒有設定!";
308
 
309
			#回傳結果
310
			return $result;
311
 
312
			}#if end
313
 
314
		#如果 $conf["method"] 沒有設定
315
		if(!isset($conf["method"])){
316
 
317
			$conf["method"]="http";
318
 
319
			}#if end
320
 
321
		#如果$conf["port"]沒設定
322
		if(!isset($conf["port"])){
323
 
324
			#則設爲"80"
325
			$conf["port"]="";
326
 
327
			}#if end
328
 
329
		#反之有設定
330
		else{
331
 
332
			#加上指定連接口的符號
333
			$conf["port"]=":".$conf["port"];
334
 
335
			}#if end
336
 
337
		#如果$conf["width"]沒設定
338
		if(!isset($conf["width"])){
339
 
340
			#則$conf["width"]爲空
341
			$conf["width"]="";
342
 
343
			}#if end
344
 
345
		#如果$conf["width"]有設定
346
		else{
347
 
348
			#則按照設定值
349
			$conf["width"]=" width=".$conf["width"];
350
 
351
			}#else end
352
 
353
		#如果$conf["height"]沒設定
354
		if(!isset($conf["height"])){
355
 
356
			#則$conf["height"]爲空
357
			$conf["height"]="";
358
 
359
			}#if end
360
 
361
		#如果$conf["height"]有設定
362
		else{
363
 
364
			#則按照設定值
365
			$conf["height"]=" height=".$conf["height"];
366
 
367
			}#else end
368
 
369
		#如果$conf["alt"]沒設定
370
		if(!isset($conf["alt"])){
371
 
372
			#則$conf["alt"]爲空
373
			$conf["alt"]="";
374
 
375
			}#if end
376
 
377
		#如果$conf["alt"]有設定
378
		else{
379
 
380
			#就按照設定值
381
			$conf["alt"]=" alt=".$conf["alt"];
382
 
383
			}#else end
384
 
385
		#將客戶端IP放到 $LocalIP 變數裡面
386
		$LocalIP = $_SERVER['REMOTE_ADDR'];
387
 
388
		#放置圖片的語法
389
		$result["content"]="<img src =".$conf["method"]."://".$LocalIP.$conf["port"]."/".$conf["AbsoluteFilePosition"]." ".$conf["width"]." ".$conf["height"]." ".$conf["alt"].">";
390
 
391
		#設置執行正常
392
		$result["status"]="true";
393
 
394
		#印出圖片
395
		return $result;
396
 
397
		}#function showLocalImgWithPort end
398
 
399
	/*
400
	#函式說明:
401
	#建立含有文字的png圖檔
402
	#回傳結果:
403
	#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
404
	#$result["error"],錯誤訊息陣列
405
	#$result["function"],當前執行的函數名稱
406
	#$result["content"],圖片的位置與檔案名稱
407
	#必填參數:
408
	#$conf["imgWidth"],整數,圖片的寬度.
409
	$conf["imgWidth"]=0;
410
	#$conf["imgHeight"],整數,圖片的高度.
411
	$conf["imgHeight"]=0;
412
	#$conf["imgStoreAddAndName"],字串,圖片要儲存到的地方以及其名稱.
413
	$conf["imgStoreAddAndName"]="";
414
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
415
	$conf["fileArgu"]=__FILE__;
416
	#可省略參數:
417
	#$conf["bgRedNum"]=0;#圖片的紅色底色數值0~255,預設爲0
418
	#$conf["bgGreenNum"]=0;#圖片的綠色底色數值0~255,預設爲0
419
	#$conf["bgBlueNum"]=0;#圖片的藍色底色數值0~255,預設爲0
420
	#$conf["strOnImg"]="";#要出現在圖片上的文字,預設為""
421
	#$conf["textRedNum"]=255;#文字顏色的紅色數值0~255,預設爲255
422
	#$conf["textGreenNum"]=255;#文字顏色的綠色數值0~255,預設爲255
423
	#$conf["textBlueNum"]=255;#文字顏色的藍色數值0~255,預設爲255
424
	#$conf["drawLine"]=array("");#可以畫多條線,參數格式爲「0,0,200,100,50,100,150 」,每個參數依序代表x0、y0爲線條的起始點;x1、y1爲線條的終點;red、green、blue爲線條的顏色數值(0~255)
425
	#$conf["replaceOriImg"]="false";#如果遇到相同名字會將之刪除,flase爲不要刪除,預設為"false".
426
	#參考資料:
427
	#imagecreate=>http://php.net/manual/en/function.imagecreate.php
428
	#imagecolorallocate=>http://php.net/manual/en/function.imagecolorallocate.php
429
	#imagestring=>http://php.net/manual/en/function.imagestring.php
430
	#imageline=>http://php.net/manual/en/function.imageline.php
431
	#imagepng=>http://php.net/manual/en/function.imagepng.php
432
	#imagedestroy=>http://php.net/manual/en/function.imagedestroy.php
433
	#備註:
434
	#無.
435
	*/
436
	public static function create(&$conf){
437
 
438
		#初始化要回傳的變數
439
		$result=array();
440
 
441
		#記錄當前執行的函數名稱
442
		$result["function"]=__FUNCTION__;
443
 
444
		#如果 $conf 不為陣列
445
		if(gettype($conf)!="array"){
446
 
447
			#設置執行失敗
448
			$result["status"]="false";
449
 
450
			#設置執行錯誤訊息
451
			$result["error"][]="\$conf變數須為陣列形態";
452
 
453
			#如果傳入的參數為 null
454
			if($conf==null){
455
 
456
				#設置執行錯誤訊息
457
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
458
 
459
				}#if end
460
 
461
			#回傳結果
462
			return $result;
463
 
464
			}#if end
465
 
466
		#檢查參數
467
		#函式說明:
468
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
469
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
470
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
471
		#$result["function"],當前執行的函式名稱.
472
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
473
		#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
474
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
475
		#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
476
		#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
477
		#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
478
		#$result["notNeedVar"],字串陣列,多餘的參數名稱.
479
		#必填寫的參數:
480
		#$conf["variableCheck::checkArguments"]["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
481
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
482
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
483
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgWidth","imgHeight","imgStoreAddAndName");
484
		#$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
485
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","integer","integer","string");
486
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
487
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
488
		#可以省略的參數:
489
		#$conf["variableCheck::checkArguments"]["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
490
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
491
		#$conf["variableCheck::checkArguments"]["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
492
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("bgRedNum","bgGreenNum","bgBlueNum","strOnImg","textRedNum","textGreenNum","textBlueNum","drawLine","replaceOriImg");
493
		#$conf["variableCheck::checkArguments"]["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
494
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("integer","integer","integer","string","integer","integer","integer","array","string");
495
		#$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
496
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(0,0,0,"",255,255,255,null,"false");
497
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
498
		#$conf["variableCheck::checkArguments"]["arrayCountEqualCheck"][]=array();
499
		#參考資料來源:
500
		#array_keys=>http://php.net/manual/en/function.array-keys.php
501
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
502
		unset($conf["variableCheck::checkArguments"]);
503
 
504
		#如果檢查失敗
505
		if($checkResult["status"]=="false"){
506
 
507
			#設置錯誤狀態
508
			$result["status"]="false";
509
 
510
			#設置錯誤提示
511
			$result["error"]=$checkResult;
512
 
513
			#回傳結果
514
			return $result;
515
 
516
			}#if end
517
 
518
		#如果檢查不通過
519
		if($checkResult["passed"]=="false"){
520
 
521
			#設置錯誤狀態
522
			$result["status"]="false";
523
 
524
			#設置錯誤提示
525
			$result["error"]=$checkResult;
526
 
527
			#回傳結果
528
			return $result;
529
 
530
			}#if end
531
 
532
		#如果有設置 $conf["replaceOriImg"] 變數
533
		if(isset($conf["replaceOriImg"])){
534
 
535
			#如果要移除相同檔名的檔案
536
			if($conf["replaceOriImg"] != "false"){
537
 
538
				#函式說明:檢查多個檔案與資料夾是否存在
539
				#回傳的結果:
540
				#$result["status"],執行正常與否,"true"代表正常,"false"代表不正常.
541
				#$result["error"],錯誤訊息陣列.
542
				#$resutl["function"],當前執行的涵式名稱.
543
				#$result["allExist"],所有檔案皆存在的識別,"true"代表皆存在,"false"代表沒有全部都存在.
544
				#$result["varName"][$i],爲第$i個資料夾或檔案的名稱。
545
				#$result["varExist"][$i],爲第$i個資料夾或檔案是否存在,"true"代表存在,"false"代表不存在。
546
				#必填的參數:
547
				$conf["fileAccess"]["checkMutiFileExist"]["fileArray"]=array($conf["imgStoreAddAndName"].".png");#要檢查書否存在的檔案有哪些,須爲一維陣列數值。
548
				#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
549
				$conf["fileAccess"]["checkMutiFileExist"]["fileArgu"]=$conf["fileArgu"];
550
				#可省略參數
551
				#$conf["disableWebSearch"],"字串",是否取消「當檔案找不到時,改用catchWebContent類別的wget函數來檢查檔案是否存在於網路上」的功能,預設為"false"不取消,若要取消該功能請設為"true",若抓到的內容為空字串則會視為檔案不存在.
552
				$conf["fileAccess"]["checkMutiFileExist"]["disableWebSearch"]="true";
553
				#參考資料來源:
554
				#http:#php.net/manual/en/function.file-exists.php
555
				#http:#php.net/manual/en/control-structures.foreach.php
556
				$fileExist=fileAccess::checkMultiFileExist($conf["fileAccess"]["checkMutiFileExist"]);
557
				unset($conf["fileAccess"]["checkMutiFileExist"]);
558
 
559
				#如果檢查圖片檔案存在失敗
560
				if($fileExist["status"]=="false"){
561
 
562
					#設置錯誤狀態
563
					$result["status"]="false";
564
 
565
					#設置錯誤提示
566
					$result["error"]=$fileExist;
567
 
568
					#回傳結果
569
					return $result;
570
 
571
					}#if end
572
 
573
				#如果目標檔案存在
574
				if($fileExist["varExist"][0]=="true"){
575
 
576
					#移除目標檔案
577
					#函式說明:
578
					#移除檔案
579
					#回傳結果:
580
					#$result["status"],"true"代表移除成功,"false"代表移除失敗.
581
					#$result["error"],錯誤訊息陣列
582
					#$result["warning"],警告訊息陣列
583
					#$result["function"],當前執行的函數名稱
584
					#必填參數:
585
					$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgStoreAddAndName"].".png";#要移除檔案的位置
586
					#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑
587
					$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
588
					$delFile=fileAccess::delFile($conf["fileAccess::delFile"]);
589
					unset($conf["fileAccess::delFile"]);
590
 
591
					#如果移除檔案失敗
592
					if($delFile["status"]=="false"){
593
 
594
						#設置錯誤狀態
595
						$result["status"]="false";
596
 
597
						#設置錯誤提示
598
						$result["error"]=$delFile;
599
 
600
						#回傳結果
601
						return $result;
602
 
603
						}#if end
604
 
605
					}#if end
606
 
607
				}#if end
608
 
609
			}#if end
610
 
611
		#目前認爲不太好用,所以取消了。
612
		#建立填滿的黑色圖片寬爲200、高爲100
613
		#$im = imagecreatetruecolor(200, 100);
614
 
615
		#建立背景是空白的圖片,若使用失敗,則顯示錯誤訊息
616
		#若後面有設定供此圖片可以使用的顏色則第一個顏色會被作爲背景的顏色
617
		#參數1是寬度
618
		#參數2是高度
619
		#參考資料來源:http://php.net/manual/en/function.imagecreate.php
620
		$im = \imagecreate($conf["imgWidth"],$conf["imgHeight"]);
621
 
622
		#如果 $im 為 FALSE
623
		if($im==FALSE){
624
 
625
			#設置執行失敗
626
			$result["status"]="false";
627
 
628
			#設置執行錯誤訊息
629
			$result["error"][]="建立底層為空白的圖片失敗";
630
 
631
			#回傳結果
632
			return $result;
633
 
634
			}#if end
635
 
636
		#設定接下來給$im那張圖用的顏色,必須爲函式 imagecreate 製造的圖片才行
637
		#參數1爲設定好的圖片要給那張圖使用
638
		#參數2爲紅色的用量0~255
639
		#參數3爲綠色的用量0~255
640
		#參數4爲藍色的用量0~255
641
		$bgColor = imagecolorallocate($im,$conf["bgRedNum"],$conf["bgGreenNum"], $conf["bgBlueNum"]);
642
 
643
		#如果設定背景顏色失敗
644
		if($bgColor===FALSE){
645
 
646
			#設置執行失敗
647
			$result["status"]="false";
648
 
649
			#設置執行錯誤訊息
650
			$result["error"][]="設定背景顏色失敗";
651
 
652
			#回傳結果
653
			return $result;
654
 
655
			}#if end
656
 
657
		#設定接下來給文字使用的顏色,必須爲函式 imagecreate 製造的圖片才行
658
		#參數1爲設定好的圖片要給那張圖使用
659
		#參數2爲紅色的用量0~255
660
		#參數3爲綠色的用量0~255
661
		#參數4爲藍色的用量0~255
662
		$textColor = imagecolorallocate($im,$conf["textRedNum"],$conf["textGreenNum"], $conf["textBlueNum"]);
663
 
664
		#如果設定給文字使用的顏色失敗
665
		if($textColor===FALSE){
666
 
667
			#設置執行失敗
668
			$result["status"]="false";
669
 
670
			#設置執行錯誤訊息
671
			$result["error"][]="設定給文字使用的顏色失敗";
672
 
673
			#回傳結果
674
			return $result;
675
 
676
			}#if end
677
 
678
		#建立文字放在圖片上面
679
		#參數1爲要給哪張圖片使用,必須爲函式 imagecreate 製造的圖片才行
680
		#參數2爲字型的大小,可用的值爲1~5
681
		#參數3爲要從圖片左上角的x軸值開始
682
		#參數4爲要從圖片最上將的y軸值開始
683
		#參數5爲要放置的字串內容
684
		#參數6爲文字的顏色,必須使用函式 imagecolorallocate 產生的顏色才行
685
		#參考資料來源:http://php.net/manual/en/function.imagestring.php
686
		$imagestring=imagestring($im, 5 , 5 , 5 ,$conf["strOnImg"],$textColor);
687
 
688
		#如果在圖片上放置文字失敗
689
		if($imagestring==FALSE){
690
 
691
			#設置執行失敗
692
			$result["status"]="false";
693
 
694
			#設置執行錯誤訊息
695
			$result["error"][]="在圖片上放置文字失敗";
696
 
697
			#回傳結果
698
			return $result;
699
 
700
			}#if end
701
 
702
		#如果有設定畫線
703
		if(isset($conf["drawLine"])){
704
 
705
			#有幾條線就執行幾次
706
			foreach($conf["drawLine"] as $lineInfo){
707
 
708
				#解析線的資訊
709
				#範例格式: 
710
				#0,0,200,100,50,100,150;
711
 
712
				#分割字串(以,分開)
713
				#函式說明:
714
				#將固定格式的字串分開,並回傳分開的結果。
715
				#回傳的參數:
716
				#$result["dataArray"],爲分割好字串的陣列內容,$result["dataArray"][$i]爲第($i+1)段的內容。
717
				#$result["dataCounts"],爲總共分成幾段
718
				#必填參數:
719
				$conf["stringProcess"]["spiltString"]["stringIn"]=$lineInfo;#要處理的字串。
720
				$conf["stringProcess"]["spiltString"]["spiltSymbol"]=",";#爲以哪個符號作爲分割
721
				$spiltedStr1=stringProcess::spiltString($conf["stringProcess"]["spiltString"]);
722
				unset($conf["stringProcess"]["spiltString"]);
723
 
724
				#如果分割字串失敗
725
				if($spiltedStr1["status"]=="false"){
726
 
727
					#設置執行失敗
728
					$result["status"]="false";
729
 
730
					#設置執行錯誤訊息
731
					$result["error"]=$spiltedStr1;
732
 
733
					#回傳結果
734
					return $result;
735
 
736
					}#if end
737
 
738
				#建立線條的顏色
739
				#設定接下來給$im那張圖上線條用的顏色,必須爲函式 imagecreate 製造的圖片才行
740
				#參數1爲設定好的圖片要給那張圖使用
741
				#參數2爲紅色的用量0~255
742
				#參數3爲綠色的用量0~255
743
				#參數4爲藍色的用量0~255
744
				$lineColor=imagecolorallocate($im,(int)$spiltedStr1["dataArray"][4],(int)$spiltedStr1["dataArray"][5],(int)$spiltedStr1["dataArray"][6]);
745
 
746
				#如果設定給線條使用的顏色失敗
747
				if($lineColor===FALSE){
748
 
749
					#設置執行失敗
750
					$result["status"]="false";
751
 
752
					#設置執行錯誤訊息
753
					$result["error"][]="設定給線條使用的顏色失敗";
754
 
755
					#回傳結果
756
					return $result;
757
 
758
					}#if end
759
 
760
				#劃綫
761
				#參數1爲要畫在那張圖片上面,必須爲函式 imagecreate 製造的圖片才行
762
				#參數2爲綫的x軸起點
763
				#參數3爲綫的y軸起點
764
				#參數4爲線的x軸終點
765
				#參數5爲綫的y軸終點
766
				#參數6爲線的顏色樣式,必須使用函式 imagecolorallocate 產生的顏色才行
767
				$imageline=imageline($im,(int)$spiltedStr1["dataArray"][0],(int)$spiltedStr1["dataArray"][1],(int)$spiltedStr1["dataArray"][2],$spiltedStr1["dataArray"][3],$lineColor);
768
 
769
				#如果劃線失敗
770
				if($imageline==FALSE){
771
 
772
					#設置執行失敗
773
					$result["status"]="false";
774
 
775
					#設置執行錯誤訊息
776
					$result["error"][]="劃線失敗";
777
 
778
					#回傳結果
779
					return $result;
780
 
781
					}#if end
782
 
783
				}#foreach end
784
 
785
			}#if end
786
 
787
		#建立圖片並存到伺服端上
788
		#參數1爲圖片的內容變數,必須爲函式 imagecreate 製造的圖片才行 
789
		#參數2爲圖片要存在伺服端的位置與名稱
790
		#參考資料來源:http://php.net/manual/en/function.imagepng.php
791
		$imagepng=imagepng($im,$conf["imgStoreAddAndName"].".png");
792
 
793
		#如果將圖片輸出成檔案失敗
794
		if($imagepng==FALSE){
795
 
796
			#設置執行失敗
797
			$result["status"]="false";
798
 
799
			#設置執行錯誤訊息
800
			$result["error"][]="將圖片輸出到「".$conf["imgStoreAddAndName"].".png」"."失敗";
801
 
802
			#回傳結果
803
			return $result;
804
 
805
			}#if end
806
 
807
		#將圖片從記憶體裏面釋放,必須爲函式 imagecreate 製造的圖片才行
808
		$imagedestroy=imagedestroy($im);
809
 
810
		#如果卸除編輯圖片的記憶體失敗
811
		if($imagedestroy==FALSE){
812
 
813
			#設置執行失敗
814
			$result["status"]="false";
815
 
816
			#設置執行錯誤訊息
817
			$result["error"][]="卸除編輯圖片的記憶體失敗";
818
 
819
			#回傳結果
820
			return $result;
821
 
822
			}#if end
823
 
824
		#取得完整的圖片位置與名稱
825
		$result["content"]=$conf["imgStoreAddAndName"].".png";
826
 
827
		#執行到這邊代表執行正常
828
		$result["status"]="true";
829
 
830
		#回傳結果
831
		return $result;
832
 
833
		}#function create end
834
 
835
	/*
836
	#函式說明:
837
	#用data:mimeType;base64,imgVar的形式來提供圖片的連結,亦即圖片儲存在變數裡面,本函式包含顯示圖片的語法.
838
	#回傳結果:
839
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
840
	#$result["error"],錯誤訊息
841
	#$result["content"]["imgWithoutImgTag"],img的src數值內容.
842
	#$result["content"]["img"],圖片的連結資訊
843
	#$result["function"],當前執行的函數名稱 
844
	#必填參數:
845
	#$conf["imgPosition"],要轉存成2元碼的圖片檔案位置與名稱
846
	$conf["imgPosition"]="";
847
	#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
848
	$conf["fileArgu"]=__FILE__;
849
	#可省略參數:
850
	#$conf["alt"],若沒有圖片要用什麼文字顯示。
851
	#$conf["alt"]="";
852
	#$conf["style"],字串陣列,要使用的style,key為樣式名稱,value為樣式值.
853
	#$conf["style"]=array();
854
	#$conf["class"],圖片要套用的css樣式名稱.
855
	#$conf["class"]="";
856
	#$conf["mimeType"],2元碼的內容是什麼,預設為"image/*".
857
	#$conf["mimeType"]="image/*";
858
	#$conf["compressType"],2元碼壓縮的方式,預設為"base64".
859
	#$conf["compressType"]="base64";
860
	#$conf["delImg"],讀取完圖片檔案後,要移除圖片嗎?"true"代表要移除,"false"代表不要移除,預設為"false".
861
	#$conf["delImg"]="false";
862
	#參考資料:
863
	#將檔案用字串變數儲存起來=>http://php.net/manual/en/function.file-get-contents.php
864
	#壓縮2元碼=>http://php.net/manual/en/function.base64-encode.php
865
	#備註:
866
	#無.
867
	*/
868
	public static function data(&$conf){
869
 
870
		#初始化要回傳的變數
871
		$result=array();
872
 
873
		#記錄當前執行的函數名稱
874
		$result["function"]=__FUNCTION__;
875
 
876
		#如果 $conf 不為陣列
877
		if(gettype($conf)!="array"){
878
 
879
			#設置執行失敗
880
			$result["status"]="false";
881
 
882
			#設置執行錯誤訊息
883
			$result["error"][]="\$conf變數須為陣列形態";
884
 
885
			#如果傳入的參數為 null
886
			if($conf==null){
887
 
888
				#設置執行錯誤訊息
889
				$result["error"][]="\$conf變數不得為null,請檢查函數「".$result["function"]."」的參數設置有無正確!";
890
 
891
				}#if end
892
 
893
			#回傳結果
894
			return $result;
895
 
896
			}#if end
897
 
898
		#檢查參數
899
		#函式說明:
900
		#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容。
901
		#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
902
		#$reuslt["error"],執行不正常結束的錯訊息陣列.
903
		#$result["function"],當前執行的函式名稱.
904
		#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
905
		#$result[$shouldBtCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
906
		#$result[$shouldBtCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
907
		#$result[$shouldBtCheckedVarName]["error"],每個參數設定的錯誤訊息
908
		#必填寫的參數:
909
		#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
910
		$conf["variableCheck::checkArguments"]["varInput"]=&$conf;
911
		#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
912
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableName"]=array("fileArgu","imgPosition");
913
		#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列 例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double"); 
914
		$conf["variableCheck::checkArguments"]["mustBeFilledVariableType"]=array("string","string");
915
		#$conf["variableCheck::checkArguments"]["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
916
		$conf["variableCheck::checkArguments"]["referenceVarKey"]="variableCheck::checkArguments";
917
		#可以省略的參數:
918
		#$conf["canBeEmptyString"],必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true"。
919
		$conf["variableCheck::checkArguments"]["canBeEmptyString"]="false";
920
		#$conf["skipableVariableName"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
921
		$conf["variableCheck::checkArguments"]["skipableVariableName"]=array("alt","style","class","mimeType","compressType","delImg");
922
		#$conf["skipableVariableType"],爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double"); 
923
		$conf["variableCheck::checkArguments"]["skipableVariableType"]=array("string","array","string","string","string","string");
924
		#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,「null」代表不指定,若預設值是必填參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
925
		$conf["variableCheck::checkArguments"]["skipableVarDefaultValue"]=array(null,null,null,"image/*","base64","false");
926
		#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
927
		#$conf["arrayCountEqualCheck"][]=array();
928
		$checkResult=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
929
		unset($conf["variableCheck::checkArguments"]);
930
 
931
		#如果檢查參數失敗
932
		if($checkResult["status"]=="false"){
933
 
934
			#設置執行失敗
935
			$result["status"]="false";
936
 
937
			#設置錯誤訊息
938
			$result["error"]=$checkResult;
939
 
940
			#回傳結果
941
			return $result;
942
 
943
			}#if end
944
 
945
		#如果檢查參數不通過
946
		if($checkResult["passed"]=="false"){
947
 
948
			#設置執行失敗
949
			$result["status"]="false";
950
 
951
			#設置錯誤訊息
952
			$result["error"]=$checkResult;
953
 
954
			#回傳結果
955
			return $result;
956
 
957
			}#if end
958
 
959
		#讀取圖片檔案
960
		$imgBin=file_get_contents($conf["imgPosition"],"rb");
961
 
962
		#壓縮圖片檔案
963
		$base64ImgBin=base64_encode($imgBin);
964
 
965
		#如果 $conf["alt"] 有設定
966
		if(isset($conf["alt"])){
967
 
968
			#設置 alt 屬性
969
			$conf["alt"]=" alt=\"".$conf["alt"]."\" ";
970
 
971
			}#if end
972
 
973
		#反之設為 ""
974
		else{
975
 
976
			$conf["alt"]="";
977
 
978
			}#else end
979
 
980
		#如果 $conf["class"] 有設定
981
		if(isset($conf["class"])){
982
 
983
			#設置 class 屬性
984
			$conf["class"]=" class=\"".$conf["class"]."\" ";
985
 
986
			}#if end
987
 
988
		#反之設為 ""
989
		else{
990
 
991
			$conf["class"]="";
992
 
993
			}#else end
994
 
995
		#如果 $conf["delImg"] 等於 "true"
996
		if($conf["delImg"]=="true"){
997
 
998
			#移除圖片檔案
999
			#函式說明:
1000
			#移除檔案
1001
			#回傳結果:
1002
			#$result["status"],"true"代表移除成功,"false"代表移除失敗.
1003
			#$result["error"],錯誤訊息陣列
1004
			#$result["warning"],警告訊息陣列
1005
			#$result["function"],當前執行的函數名稱
1006
			#必填參數:
1007
			$conf["fileAccess::delFile"]["fileAddress"]=$conf["imgPosition"];#要移除檔案的位置
1008
			#$conf["fileArgu"],字串,php變數__FILE__的內容,亦即該檔案在檔案系統的絕對路徑.
1009
			$conf["fileAccess::delFile"]["fileArgu"]=$conf["fileArgu"];
1010
			$del=fileAccess::delFile($conf["fileAccess::delFile"]);
1011
			unset($conf["fileAccess::delFile"]);
1012
 
1013
			#如果移除圖片失敗
1014
			if($del["status"]=="false"){
1015
 
1016
				#設置執行失敗
1017
				$result["status"]="false";
1018
 
1019
				#設置錯誤訊息
1020
				$result["error"]=$del;
1021
 
1022
				#回傳結果
1023
				return $result;
1024
 
1025
				}#if end
1026
 
1027
			}#if end
1028
 
1029
		#初始化樣式字串
1030
		$style="";
1031
 
1032
		#如果有設置 $conf["style"]
1033
		if(isset($conf["style"])){
1034
 
1035
			#初始化樣式名稱陣列
1036
			$styleN=array();
1037
 
1038
			#初始化樣式值陣列
1039
			$styleV=array();
1040
 
1041
			#以據每個樣式
1042
			foreach($conf["style"] as $styleName => $styleVal){
1043
 
1044
				#取得樣式名稱
1045
				$styleN[]=$styleName;
1046
 
1047
				#取得樣式值
1048
				$styleV[]=$styleVal;
1049
 
1050
				}#foreach end
1051
 
1052
			#函式說明: 
1053
			#建立給與html標籤使用的style屬性字串.
1054
			#回傳結果:
1055
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.		
1056
			#$result["function"],當前執行的函數
1057
			#$result["error"],錯誤訊息陣列
1058
			#$result["content"],css設定內容
1059
			#必填參數:
1060
			$conf["css::styleStr"]["styleName"]=$styleN;#為屬性名稱,須為陣列值
1061
			$conf["css::styleStr"]["styleValue"]=$styleV;#為屬性值,須為陣列值
1062
			$styleStr=css::styleStr($conf["css::styleStr"]);
1063
			unset($conf["css::styleStr"]);
1064
 
1065
			#如果建立 style 字串失敗
1066
			if($styleStr["status"]==="false"){
1067
 
1068
				#設置執行失敗
1069
				$result["status"]="false";
1070
 
1071
				#設置錯誤訊息
1072
				$result["error"]=$styleStr;
1073
 
1074
				#回傳結果
1075
				return $result;
1076
 
1077
				}#if end
1078
 
1079
			#取得樣式字串
1080
			$style=$styleStr["content"];
1081
 
1082
			}#if end
1083
 
1084
		#設置 img 的 src 數值
1085
		$result["content"]["imgWithoutImgTag"]="data:".$conf["mimeType"].";".$conf["compressType"].",".$base64ImgBin;
1086
 
1087
		#放置圖片的語法
1088
		$result["content"]["img"]="<img ".$style." ".$conf["alt"]." ".$conf["class"]." src=\"".$result["content"]["imgWithoutImgTag"]."\" >";
1089
 
1090
		#執行到這邊代表執行正常
1091
		$result["status"]="true";
1092
 
1093
		#回傳結果
1094
		return $result;
1095
 
1096
		}#function data end
1097
 
1098
	/*
1099
	#函式說明:
1100
	#建立用css樣式產生的圖片div或span區塊 
1101
	#回傳結果:
1102
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1103
	#$result["error"],錯誤訊息
1104
	#$result["content"],圖片的連結資訊
1105
	#$result["function"],當前執行的函數名稱 
1106
	#必填參數:
1107
	#$conf["imgAddr"],字串,圖片的位址.
1108
	$conf["imgAddr"]="";
1109
	#可省略參數:
1110
	#$conf["imgClass"],字串,用來放置圖片的css類別樣式名稱.
1111
	#$conf["imgClass"]=""
1112
	#參考資料:
1113
	#無.
1114
	#備註:
1115
	#建構中...
1116
	*/
1117
	public static function cssContent(&$conf){
1118
 
1119
		#檢查參數
1120
 
1121
 
1122
		#設置圖片的 css class
1123
 
1124
 
1125
		#設置圖片區塊的 div
1126
 
1127
 
1128
		$result["content"]="<div class=\"cssContnetImg\" style=\"content:url(https://start.fedoraproject.org/static/images/fedora-logo.png);width:200px;height:50px;\"></div>";
1129
 
1130
		$result["status"]="true";
1131
 
1132
		return $result;
1133
 
1134
		}#functin cssContent end
1135
 
1136
	}#class img end
1137
 
1138
#內建的繪圖函式
1139
 
1140
#劃綫
1141
#參數1爲要畫在那張圖片上面,必須爲函式 imagecreate 製造的圖片才行
1142
#參數2爲綫的x軸起點
1143
#參數3爲綫的y軸起點
1144
#參數4爲線的x軸終點
1145
#參數5爲綫的y軸終點
1146
#參數6爲線的顏色樣式,必須使用函式 imagecolorallocate 產生的顏色才行
1147
#imageline($im, 0, 0, 200, 100, $red);
1148
 
1149
?>