php 图片上添加透明度渐变的效果

yipeiwu_com6年前PHP代码库

复制代码 代码如下:

<?php
////$strimgsrc = file_get_contents("/zb_users/upload/202003/e4lf1fxwbqa.jpg");
////$imgsrc = imagecreatefromstring($strimgsrc);
$imgsrc = imagecreatefromjpeg("5307754.jpg");
$imgsrcw = imagesx($imgsrc);
$imgsrch = imagesy($imgsrc);
$width = 30;
$x1 = 2;
$x2 = $imgsrcw - $x1 - 20;
$y1 = ($imgsrch - $width) - 2;
$y2 = $y1 + $width;
$steps = $x2 - $x1;
for($i = 0; $i < $steps; $i ++)
{
$alphax = round($i/($steps/127))+60;
if($alphax >= 128)
$alphax = 127;
$alpha = imagecolorallocatealpha($imgsrc, 255, 255, 255, $alphax);
imagefilledrectangle($imgsrc, ($i+$x1), $y1, ($i+$x1+1), $y2, $alpha);
}
header('content-type: image/jpeg');
imagejpeg($imgsrc);
imagedestroy($imgsrc);
?>

相关文章

php实现短信发送代码

卓望的短信发送。PHP格式。都要不习惯用xml传输数据格式了 标签: <无> 1. [代码][PHP]代码     <...

Session保存到数据库的php类分享

复制代码 代码如下: <?php class SessionToDB { private $_path = null; private $_name = null; private...

Apache实现Web Server负载均衡详解(不考虑Session版)

至少需三台服务器:服务器A:控制服务器服务器B和服务器C:实际执行服务器负载均衡原理:将访问服务器A的请求分发至服务器B和服务器C修改服务器A上apache的http.conf文件: 首...

解析php file_exists无效的解决办法

方法1 :据官方手册上描述若php教程的safe mode相关的设置过于苛刻,就会出现这样的情形:尽管文件真实存在也被误报,认为文件不存在。 由于服务器端的php.ini我们无法操纵,当...

php magic_quotes_gpc的一点认识与分析

blankyao 说“学习的过程就是不断的发现错误,不断的改正错误”; 先看下手册上怎么说的吧! 对一般人来说看下前两段就可以了 Magic Quotes 代码: Magic Quote...