赞
踩
- <?php
- $dst_path = "2.jpg";
- $dst = imagecreatefromstring(file_get_contents($dst_path));
- $w = imagesx($dst);
- $h = imagesy($dst);
- $font = 'font/Lato-Black.ttf';
- $black = imagecolorallocate($dst, 192, 192, 192);
- $hw = 180;
- $angle = 45; //倾斜角度
- $size = 15;//字体大小
-
- for ($i = 0; $i <= ($w / $hw ); $i++) {
- for ($hs = 1; $hs <= ($h / $hw ); $hs++) {
- imagefttext($dst, $size, $angle , ($i * $hw ) , $hs * $hw , $black, $font, 'looks.wang');
- }
- }
-
- list ($dst_w, $dst_h, $dst_type) = getimagesize($dst_path);
-
- switch ($dst_type) {
- case 1: // GIF
- header("content-type:image/gif");
- imagegif($dst);
- break;
- case 2: // JPG
- header("content-type:image/jpeg");
- imagejpeg($dst);
- break;
- case 3: // PNG
- header("content-type:image/png");
- imagepng($dst);
- break;
- default:
- break;
- }
- // 销毁图片
- imagedestroy($dst);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。