FoundPHP 照片:色块
FoundPHP 照片:色块
框架下默认集成 FoundPHP_image 支持格式:jpg、jpeg、png、gif
应用库地址:class/image/resize.php
采用GD库php默认memory_limit是128M,如果需要处理大尺寸照片修改512M以上。
任意坐标添加色块
色块的位置在文字的下层,可以作为文字的底色。
$FoundPHP_image->image('foundphp.jpg');
//设置色块
$FoundPHP_image->block(
array(
'color' => '#00a9f5', //颜色
'x' => 20, //坐标
'y' => 180, //坐标
'width' => 100, //宽度
'height' => 100, //高度
)
);
//标准缩放
$FoundPHP_image->resize(array(
'width' =>400,
'height' =>400,
'cut' =>1, //1切图,0不切图
'zoom' =>1, //按比例缩放
));
$FoundPHP_image->save('foundphp_new');
实现效果:
添加多色色块
色块的位置在文字的下层,可以作为文字的底色。
$FoundPHP_image->image('foundphp.jpg');
//设置色块
$FoundPHP_image->block(
array(
'color' => '#00a9f5', //颜色
'x' => 30, //坐标
'y' => 50, //坐标
'width' => 100, //宽度
'height' => 100, //高度
)
);
//设置色块
$FoundPHP_image->block(
array(
'color' => '#dedede', //颜色
'x' => 40, //坐标
'y' => 60, //坐标
'width' => 100, //宽度
'height' => 100, //高度
)
);
//设置色块
$FoundPHP_image->block(
array(
'color' => '#800000', //颜色
'x' => 50, //坐标
'y' => 70, //坐标
'width' => 100, //宽度
'height' => 100, //高度
)
);
//标准缩放
$FoundPHP_image->resize(array(
'width' =>400,
'height' =>400,
'cut' =>1, //1切图,0不切图
'zoom' =>1, //按比例缩放
));
$FoundPHP_image->save('foundphp_new');
实现效果: