PHP图形图像处理技术如何应用于长尾关键词优化?
- 内容介绍
- 文章标签
- 相关推荐
本文共计255个文字,预计阅读时间需要2分钟。
php
<?php
header("content-type:image/jpeg");
/*一、简单的图像输出*/
$im = imagecreate(60,40);
$pink = imagecolorallocate($im,35, 25,220);
imagejpeg($im);
//imagestring($im,16, 200, 200,"I LOVE YOU",);
/* 二、将字符串写入到图片中 */
//载入图片
$me=imagecreatefromjpeg("../../images/3.jpg");
//设置字体颜色
$text_color = imagecolorallocate($me, 255,84,0);
//设置的字体的位置
$font = "C:\Windows\Fonts\simkai.ttf";
//要写入的字符串
$str = iconv('GBK',"UTF-8", "php开发...");
//将字符串写入到图片中
imagettftext($me,20,0,50,50, $text_color,$font, $str);
//输出图片
imagejpeg($me);
//释放资源
imagedestroy($me);
session_start(); header("content-type:image/jpeg"); //验证码 //图像宽度 $image_width =65; //图像高度 $image_height =45; //设置随机数的种子 //srand(microtime()*1000); for ($i=0;$i<6;$i++){ $new_str .=dechex(rand(0, 100)); } $_SESSION[code]=$new_str; $image = imagecreate($image_width, $image_height); imagecolorallocate($image,rand(0,255), rand(0,255),rand(0,255)); for ($i=0;$i<strlen($_SESSION[code]);$i++){ $font = mt_rand(3, 8);//生成随机字体大小 $x = mt_rand(3,10)+$image_width*$i/4; $y = mt_rand(3,$image_height/4); $color = imagecolorallocate($image,mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); imagestring($image, $font, $x, $y,$_SESSION[code][$i], $color); } imagepng($image); imagedestroy($image);
本文共计255个文字,预计阅读时间需要2分钟。
php
<?php
header("content-type:image/jpeg");
/*一、简单的图像输出*/
$im = imagecreate(60,40);
$pink = imagecolorallocate($im,35, 25,220);
imagejpeg($im);
//imagestring($im,16, 200, 200,"I LOVE YOU",);
/* 二、将字符串写入到图片中 */
//载入图片
$me=imagecreatefromjpeg("../../images/3.jpg");
//设置字体颜色
$text_color = imagecolorallocate($me, 255,84,0);
//设置的字体的位置
$font = "C:\Windows\Fonts\simkai.ttf";
//要写入的字符串
$str = iconv('GBK',"UTF-8", "php开发...");
//将字符串写入到图片中
imagettftext($me,20,0,50,50, $text_color,$font, $str);
//输出图片
imagejpeg($me);
//释放资源
imagedestroy($me);
session_start(); header("content-type:image/jpeg"); //验证码 //图像宽度 $image_width =65; //图像高度 $image_height =45; //设置随机数的种子 //srand(microtime()*1000); for ($i=0;$i<6;$i++){ $new_str .=dechex(rand(0, 100)); } $_SESSION[code]=$new_str; $image = imagecreate($image_width, $image_height); imagecolorallocate($image,rand(0,255), rand(0,255),rand(0,255)); for ($i=0;$i<strlen($_SESSION[code]);$i++){ $font = mt_rand(3, 8);//生成随机字体大小 $x = mt_rand(3,10)+$image_width*$i/4; $y = mt_rand(3,$image_height/4); $color = imagecolorallocate($image,mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255)); imagestring($image, $font, $x, $y,$_SESSION[code][$i], $color); } imagepng($image); imagedestroy($image);

