国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? PHP ??? ?? ?? ???(????, ???) [?? ?? ? ??? ??? ???]

PHP ??? ?? ?? ???(????, ???) [?? ?? ? ??? ??? ???]

Jul 25, 2016 am 08:44 AM

??? ????, ??? ?? ??? ???? ??? ??? ?? ??????.
??? ???? ???? ???? ? ??? ????. ??? ???? ????? ?? ???? ???, ?? ??? ???? ??? ? ???? ????. ? ???? ?? ??? ??? ??? ???? ??? ????.
?? ?? ??: ???? ??? ?? ??? ????? ???? ?????? ??? ? ????. ??? ?? ??? ?? ??? ????? ???? ????.
??? ? ??: ??? ??? ?? ??? ????? ???? ?? ??? ??? ? ????. ??? ??? ???? ??? ? ????.image.php
  1. /**
  2. *
  3. * ??? ?? ???
  4. * @author FC_LAMP
  5. * @internal ?? ??: ????, ???
  6. */
  7. class Img
  8. {
  9. //??? ??
  10. ??? $exts = ??('jpg', 'jpeg', 'gif', 'bmp', 'png' );
  11. /**
  12. *
  13. *
  14. * @throws ??
  15. */
  16. ?? ?? __construct()
  17. {
  18. if (! function_exists ( 'gd_info' ))
  19. {
  20. throw new Exception ( 'GD ?????? ???? ?????!' );
  21. }
  22. }
  23. /**
  24. *
  25. * ??? ? ??
  26. * @param $src_img ???
  27. * @param $save_img ?? ???
  28. * @param $option ???? ??(?? ??): $maxwidth width $maxheight height
  29. * array('width'=>xx,'height'=>xxx)
  30. * @internal
  31. * ???? ?? ??? ?? ?? ?? ???? ???? ??? ?? ??
  32. *?? ????? ?? ??? ????? ???? ??? ?????.
  33. */
  34. ?? ?? Thumb_img($src_img, $save_img = '', $option)
  35. {
  36. if (?? ?? ( $option ['width'] ) ?? ?? ?? ( $option ['height'] ))
  37. {
  38. return array ('flag' => False, 'msg' = > '?? ???? ??? ??? 0?? ?? ? ????.' );
  39. }
  40. $org_ext = $this->is_img ( $src_img );
  41. if (! $org_ext [' flag'])
  42. {
  43. return $org_ext;
  44. }
  45. //?? ??? ??? ??? ???? ??
  46. if (!empty ( $save_img ))
  47. {
  48. $f = $this->check_dir ( $save_img );
  49. if (! $f ['flag'])
  50. {
  51. return $f;
  52. }
  53. }
  54. //?? ??? ????
  55. $org_funcs = $this->get_img_funcs ( $org_ext ['msg'] );
  56. //???? ?? ??
  57. $source = $org_funcs ['create_func'] ( $src_img );
  58. $src_w = Imagesx ( $source );
  59. $src_h = imagey ( $source );
  60. //?? ??? ??(??? ?? ?? ?? ??? ??)
  61. $dst_scale = $option ['height'] / $option ['width'] // ?? ??? ?? ?? ??
  62. $src_scale = $ src_h / $src_w; // ?? ??? ?? ?? ??
  63. if ($src_scale >= $dst_scale)
  64. { // ?? ??
  65. $w = intval ( $src_w );
  66. $h = intval ( $dst_scale * $w ) ;
  67. $x = 0;
  68. $y = ($src_h - $h) / 3;
  69. } else
  70. { // ?? ??
  71. $h = intval ( $ src_h );
  72. $w = intval ( $h / $dst_scale );
  73. $x = ($src_w - $w) / 2;
  74. $y = 0;
  75. }
  76. // ???
  77. $croped = imagecreatetruecolor( $w, $h );
  78. imagecopy( $croped, $source, 0, 0, $x, $y, $ src_w, $src_h );
  79. // ?? ??
  80. $scale = $option ['??'] / $w;
  81. $target = imagecreatetruecolor ( $option ['??'], $option ['?? '] );
  82. $ final_w = intval ( $w * $scale );
  83. $final_h = intval ( $h * $scale );
  84. imagecopyresampled ( $target, $croped, 0, 0, 0 , 0, $final_w, $final_h , $w, $h );
  85. imagedestroy ( $croped );
  86. //??(??) ???
  87. if (!empty ( $save_img ))
  88. {
  89. $org_funcs ['save_func'] ( $target, $save_img );
  90. } else
  91. {
  92. ??( $org_funcs ['header'] );
  93. $org_funcs ['save_func'] ( $target );
  94. }
  95. imagedestroy ( $target );
  96. return array ('flag' => True, 'msg' => '' );
  97. }
  98. /**
  99. *
  100. * ??? ???
  101. * @param $src_img ?? ???
  102. * @param $save_img ?? ??
  103. * @param $option ???? ?? array('width'= >xx ,'?'=>xxx)
  104. *
  105. */
  106. ?? resize_image($src_img, $save_img = '', $option)
  107. {
  108. $org_ext = $this-> ;is_img ( $src_img );
  109. if (! $org_ext ['flag'])
  110. {
  111. return $org_ext;
  112. }
  113. //?? ??? ?? ?? , ??? ???? ??
  114. if (!empty ( $save_img ))
  115. {
  116. $f = $this->check_dir ( $save_img );
  117. if (! $f [' flag'])
  118. {
  119. return $f;
  120. }
  121. }
  122. //?? ??? ????
  123. $org_funcs = $this->get_img_funcs ( $org_ext ['msg'] );
  124. //?? ?? ????
  125. $source = $org_funcs ['create_func'] ( $src_img );
  126. $src_w = Imagesx ( $source );
  127. $src_h = ??? ( $source );
  128. if (($option ['??'] && $src_w > $option ['??']) || ($option ['??'] && $src_h > $option ['??' ]))
  129. {
  130. if ($option ['??'] && $src_w > $option ['??'])
  131. {
  132. $widthratio = $option ['??'] / $src_w;
  133. $resizewidth_tag = true;
  134. }
  135. if ($option ['height'] && $src_h > $option [' height'])
  136. {
  137. $heightratio = $option ['height'] / $src_h;
  138. $resizeheight_tag = true;
  139. }
  140. if ($resizewidth_tag && $resizeheight_tag )
  141. {
  142. if ($ widthratio < $heightratio)
  143. $ratio = $widthratio;
  144. else
  145. $ratio = $heightratio;
  146. }
  147. if ($resizewidth_tag && ! $resizeheight_tag)
  148. $ratio = $widthratio;
  149. if ($resizeheight_tag && ! $resizewidth_tag)
  150. $ratio = $heightratio;
  151. $newwidth = $src_w * $ratio;
  152. $newheight = $src_h * $ratio;
  153. if (function_exists ( "imagecopyresampled" ))
  154. {
  155. $newim = imagecreatetruecolor ( $newwidth, $newheight );
  156. imagecopyresampled( $newim, $source, 0 , 0, 0, 0, $newwidth, $newheight, $src_w, $src_h );
  157. } else
  158. {
  159. $newim = imagecreate( $newwidth , $newheight );
  160. imagecopyreised ( $ newim, $source, 0, 0, 0, 0, $newwidth, $newheight, $src_w, $src_h );
  161. }
  162. }
  163. //?? ??(??)
  164. if (!empty ( $save_img ))
  165. {
  166. $org_funcs ['save_func'] ( $newim, $save_img );
  167. } else
  168. {
  169. ??( $org_funcs ['header'] );
  170. $org_funcs ['save_func']( $newim );
  171. }
  172. imagedestroy( $newim );
  173. ?? ?? ('flag' => True, 'msg' => '' );
  174. }
  175. /**
  176. *
  177. * ???? ??? ??
  178. * @param $org_img ?? ???
  179. * @param $mark_img ???? ???
  180. * @param $save_img ????? ???? ??? Create? ?????. ????
  181. * @param array $option ????? ?? ?? ??? ??? ????.
  182. * x: ????? ?? ??, ???? ???? ???? ??? ? ????.
  183. * y: ????? ?? ??, ???? ????? ??? ? ?
  184. * alpha: ?? ?(??? ??), ???? 50
  185. */
  186. ?? ?? water_mark($org_img, $mark_img, $save_img = '', $option = array())
  187. {
  188. //?? ??
  189. $org_ext = $this->is_img ( $org_img );
  190. if ( ! $org_ext ['???'])
  191. {
  192. return $org_ext;
  193. }
  194. $mark_ext = $this->is_img ( $mark_img );
  195. if (! $mark_ext [ ' flag'])
  196. {
  197. return $mark_ext;
  198. }
  199. //?? ??? ??? ??? ??? ??
  200. if (!empty ( $save_img ))
  201. {
  202. $f = $this->check_dir ( $save_img );
  203. if (! $f ['flag'])
  204. {
  205. return $f;
  206. }
  207. }
  208. //?? ??? ????
  209. $org_funcs = $this->get_img_funcs ( $org_ext ['msg'] );
  210. $org_img_im = $org_funcs ['create_func' ] ( $org_img ) ;
  211. $mark_funcs = $this->get_img_funcs ( $mark_ext ['msg'] );
  212. $mark_img_im = $mark_funcs ['create_func'] ( $mark_img );
  213. //???? ??? ?? ??
  214. $mark_img_im_x = 0;
  215. $mark_img_im_y = 0;
  216. //???? ??? ?? ? ?? ??
  217. $mark_img_w = ????imagesx ( $mark_img_im );
  218. $mark_img_h = ???( $mark_img_im );
  219. $org_img_w = ???????x( $org_img_im );
  220. $org_img_h = ???x( $org_img_im );
  221. / /?? ??? ??
  222. $x = $org_img_w - $mark_img_w;
  223. $org_img_im_x = isset ( $option ['x'] ) ? $option ['x'] : $x;
  224. $org_img_im_x = ($org_img_im_x > $org_img_w ?? $ org_img_im_x < 0) ? $x : $org_img_im_x;
  225. $y = $org_img_h - $mark_img_h;
  226. $org_img_im_y = isset ( $option ['y'] ) ? $option ['y'] : $ y;
  227. $org_img_im_y = ($org_img_im_y > $org_img_h ?? $org_img_im_y < 0) ? $y : $org_img_im_y;
  228. //??
  229. $alpha = isset ( $option [' alpha'] ) ? $option ['alpha'] : 50;
  230. $alpha = ($alpha > 100 ?? $alpha < 50) : $alpha;
  231. //??? ??
  232. imagecopymerge ( $org_img_im, $mark_img_im, $org_img_im_x, $org_img_im_y, $mark_img_im_x, $mark_img_im_y, $mark_img_w, $mark_img_h, $alpha );
  233. / /??(??) ???
  234. if (!empty ( $save_img ))
  235. {
  236. $org_funcs ['save_func'] ( $org_img_im, $save_img );
  237. } else
  238. {
  239. ??( $org_funcs [ 'header'] );
  240. $org_funcs ['save_func']( $org_img_im );
  241. }
  242. //??? ??
  243. imagedestroy( $org_img_im );
  244. imagedestroy ( $mark_img_im );
  245. return array ('flag' => True, 'msg' => '' );
  246. }
  247. /* *
  248. *
  249. * ??? ??
  250. * @paramknown_type $img_path
  251. * @return array('flag'=>true/false,'msg'=>ext/error message)
  252. */
  253. ??? ?? is_img($img_path)
  254. {
  255. if (!file_exists ( $img_path ))
  256. {
  257. ?? ?? ('flag' => False, 'msg' => "$img_path ??? ?? ??! " );
  258. }
  259. $ext = ??( '.', $img_path );
  260. $ext = strtolower( end( $ext ) );
  261. if(!in_array( $ext, $ this->exts ))
  262. {
  263. return array ('flag' => False, 'msg' => "$img_path ???? ??? ???????!" );
  264. }
  265. ?? ?? ('flag' => True, 'msg' => $ext );
  266. }
  267. /**
  268. *
  269. * ??? ??? ??? ?????
  270. * @paramknown_type $ext
  271. */
  272. ??? ?? get_img_funcs($ext)
  273. {
  274. //選擇
  275. ???($ext)
  276. {
  277. case 'jpg' :
  278. $header = 'Content-Type: image/jpeg';
  279. $createfunc = 'imagecreatefromjpeg';
  280. $savefunc = 'imagejpeg';
  281. break;
  282. case 'jpeg' :
  283. $header = 'Content-Type:image /jpeg';
  284. $createfunc = 'imagecreatefromjpeg';
  285. $savefunc = 'imagejpeg';
  286. break;
  287. case 'gif' :
  288. $header = 'Content-Type:image/ gif';
  289. $createfunc = 'imagecreatefromgif';
  290. $savefunc = 'imagegif';
  291. break;
  292. case 'bmp' :
  293. $header = '??? ??:???/bmp ';
  294. $createfunc = 'imagecreatefrombmp';
  295. $savefunc = 'imagebmp';
  296. break;
  297. ???:
  298. $header = 'Content-Type:image/png';
  299. $createfunc = 'imagecreatefrompng';
  300. $savefunc = 'imagepng';
  301. }
  302. ?? ??('save_func' => $savefunc, 'create_func' => $createfunc, 'header' = > $header );
  303. }
  304. /**
  305. *
  306. * ????? ???? ??? ???.
  307. * @param $save_img
  308. */
  309. ??? ?? check_dir($save_img)
  310. {
  311. $dir = dirname ( $save_img );
  312. ??(! is_dir ( $dir ))
  313. {
  314. if (! mkdir ( $dir, 0777, true ))
  315. {
  316. return array ('flag' => False, 'msg' => "圖文保存目錄 $dir 無法創(chuàng)建!" );
  317. }
  318. }
  319. ?? ?? ('flag' => True, 'msg' => '' );
  320. }
  321. }
  322. if (! ?? ?? ( $_FILES ['test'] ['tmp_name'] ))
  323. {
  324. //例子
  325. $img = new Img ();
  326. //??
  327. $name = ??( '.', $_FILES ['test'] ['name'] );
  328. $org_img = 'D:/test.' . end ( $name );
  329. move_uploaded_file ( $_FILES ['test'] ['tmp_name'], $org_img );
  330. $option = array ('width' => $_POST ['width'], '??' => $_POST ['??'] );
  331. if ($_POST ['type'] == 1)
  332. {
  333. $s = $img->resize_image ( $org_img , '', $option );
  334. } else
  335. {
  336. $img->thumb_img( $org_img, '', $option );
  337. }
  338. ?? ??( $org_img );
  339. }
復代碼

?? ??:

水印
  1. $img = ? Img();
  2. $org_img = 'D:/tt.png';
  3. $mark_img = 'D:/t .png';
  4. //保存水印圖 Images(如果$save_img為空時,將會直接輸圖文)
  5. $save_img = 'D:/test99h/testone/sss.png';
  6. //水印設(shè)置調(diào)節(jié)
  7. $option = array ('x' => 50, 'y' => 50, 'alpha' => 80 );
  8. //生成水印圖文
  9. $flag = $img->water_mark ( $org_img, $mark_img, $save_img, $option );
復代碼

當我們調(diào)節(jié) $option 參數(shù)時,會有數(shù)變化:

1 $option = ??('x' => 0, 'y' => 0, '??' => 50 );

2$option = ??('x' => 50, 'y' => 50, '??' => 80 );


3 如果你不設(shè)置$option 參數(shù),將會采用默認值:

如果要純文字式的水印,可以參看這里:http://www.php.net/manual/zh/image.examples.merged-watermark.php
  1. //例子
  2. $img = ? ???();
  3. $org_img = 'D:/tt.png';
  4. //壓縮圖picture(100*100)
  5. $option = array ('width' => 100, 'height' => 100 );
  6. //$save_img為空時,將會直接輸?圖???到瀏覽器
  7. $save_img = 'D:/test99h/testone/sss_thumb.png';
  8. $flag = $img->thumb_img ( $org_img, $save_img, $option );
復代碼

調(diào)節(jié)$??? ? ??:
  1. $option = ??('??' => 200, '??' => 200);
???碼

水印與壓縮圖
  1. $img = new Img ();
  2. //hara圖
  3. $org_img = 'D:/tt.png';
  4. //水印標記圖
  5. $mark_img = 'D:/t.png';
  6. //保存水印圖文
  7. $save_img = 'D:/test99h/testone/sss.png';
  8. //水印設(shè)置調(diào)節(jié)
  9. $option = array ('x' => 50, 'y' => 50, 'alpha' => 60 );
  10. //生成水印圖文
  11. $flag = $img->water_mark ( $org_img, $mark_img, $save_img, $option );
  12. //壓縮水印圖文
  13. $option = array ('??' => 200, '??' => 200 );
  14. //保存壓縮圖
  15. $save_img2 = 'D:/test99h/testone/sss2_thumb.png';
  16. $flag = $img->thumb_img ( $save_img, $save_img2, $ ?? ); //等比例壓縮類似
復代碼

??? ???? ???? ??? ?, ?? ? ??? ???? ??? ?? ??? ? ???? ???? ???? ???. ??? ??? ? ? ?? ??? ?????.

?? ??: ??? ??? ??? ?? ??? ?? ????.
??? ??, ??, PHP


? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

?? PHP : ??? ??? ?? PHP : ??? ??? Jul 18, 2025 am 04:54 AM

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP?? ??? ? ???? ??? ????? ?? PHP?? ??? ? ???? ??? ????? ?? Jul 12, 2025 am 03:15 AM

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

?? PHP ?? ??? ?? PHP ?? ??? Jul 18, 2025 am 04:52 AM

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

See all articles