mark.php

来自「一个很漂亮的相册系统」· PHP 代码 · 共 34 行

PHP
34
字号
<?php require 'config.php';$dh = opendir($paths); while(false !== ($file = readdir($dh))) {      if($file[0] != '.') {          echo '正在添加水印到 '.$paths.$file."\n <br>";          $fileinfo = pathinfo($file);          switch(strtolower($fileinfo['extension'])) {          case 'png':              $ih = imagecreatefrompng($paths.$file);              break;          case 'jpg':          case 'jpeg':          case 'jpe':              $ih = imagecreatefromjpeg($paths.$file);              break;          case 'gif':              $ih = imagecreatefromgif($paths.$file);              break;          default:              echo '位置文件后缀名'.$fileinfo['extension']."\n";              break;          }          imagealphablending($ih, true);          $color = imagecolorallocatealpha($ih, 255, 0, 0, 50);          $x = (imagesx($ih) - strlen($text) * imagefontwidth($fontsize)) / 2;          $y = imagesy($ih) - imagefontheight($fontsize) * 1.2;          imagestring($ih, $fontsize, $x, $y, $text, $color);          imagejpeg($ih, $paths.basename($file, '.'.$fileinfo['extension']).'-x.jpg');      } } closedir($dh); ?> 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?