📄 mark.php
字号:
<?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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -