本港台最快开奖结果_本港台118kj开奖现场_明日大富翁开奖结果

[2019]本港台最快开奖结果是给大家带来了一个可以免费下载正版的机会,1本港台118kj开奖现场为玩家提供免费好玩的iPad游戏下载,点击明日大富翁开奖结果了解更多优惠信息,因为只有在注册之后下载下来的平台才是官方指定的。

js实现裁剪任意形状图片_php技巧_脚本之家

来源:http://www.alloutofdebt.com 作者:本港台118kj开奖现场 人气:192 发布时间:2019-11-27
摘要:前段时间完成相关的类型,由于连串应用html2canvas,可是不扶持cssmask属性,故,利用php后台来裁剪。 筹划两张图纸,一张是镂空PNG图案,一张是随便纯色图片。 便可以预知在纯色图片

前段时间完成相关的类型,由于连串应用html2canvas,可是不扶持css mask属性,故,利用php后台来裁剪。

筹划两张图纸,一张是镂空PNG图案,一张是随便纯色图片。

便可以预知在纯色图片上裁剪出镂空的图腾为PNG文件。

html2canvas, { onrendered: function { url = canvas.toDataURL; sourcePic = "assets/images/demo.png"; maskPic = "assets/images/jinmao.png"; cropPicName = "cropDog1"; // ajax php截图 $.ajax({ type: 'post', url: 'getpicture', data: { "sourcePic": sourcePic, "maskPic": maskPic, "cropPicName": cropPicName }, success: function[0].setAttribute("src", "assets/images/crop/cropDog1.png"); }, error: function { console.log;

 public function actionGetpicture() { $request = Yii::$app->request; $sourcePic=$request->post; $maskPic=$request->post; $cropPicName=$request->post; // $sourcePic="http://bings.local.com/bi_ngs2_2/assets/images/yinpian1/page2Bg4.png"; // $maskPic="http://bings.local.com/bi_ngs2_2/assets/images/jinmao.png"; $source = imagecreatefrompng; $mask = imagecreatefrompng; // Apply mask to source // imagealphamask; $this->imagealphamask ; // Output header( "Content-type: image/png"); // 生成截取后的图片并保存在本地 imagepng( $source,"assets/images/crop/".$cropPicName.".png" ); //销毁图片内存 imagedestroy; } public function imagealphamask { // Get sizes and set up new picture $xSize = imagesx; $ySize = imagesy; $newPicture = imagecreatetruecolor; imagesavealpha; imagefill( $newPicture, 0, 0, imagecolorallocatealpha( $newPicture, 100, 100, 0, 127 ) ); // Resize mask if necessary // if( $xSize != imagesx || $ySize != imagesy { // $tempPic = imagecreatetruecolor; // imagecopyresampled( $tempPic, $mask, 0, 0, 0, 0, $xSize, $ySize, imagesx, imagesy; // imagedestroy; // $mask = $tempPic; // } // Perform pixel-based alpha map application for( $x = 0; $x < $xSize; $x++ ) { for( $y = 0; $y < $ySize; $y++ ) { $alpha = imagecolorsforindex( $mask, imagecolorat; //small mod to extract alpha, if using a black and white //mask file instead change the following line back to Jules's original: // $alpha = 127 - floor; //or a white and black mask file: // $alpha = floor; $alpha = $alpha['alpha']; $color = imagecolorsforindex( $picture, imagecolorat; //preserve alpha by comparing the two values if ($color['alpha'] > $alpha) $alpha = $color['alpha']; //kill data for fully transparent pixels if  { $color['red'] = 0; $color['blue'] = 0; $color['green'] = 0; } imagesetpixel( $newPicture, $x, $y, imagecolorallocatealpha( $newPicture, $color[ 'red' ], $color[ 'green' ], $color[ 'blue' ], $alpha ) ); } } // Copy back to original picture imagedestroy; $picture = $newPicture; } 

上述即是本文的全部内容,希望对大家的就学抱有利于,也盼望大家多都赐教脚本之家。

本文由本港台最快开奖结果发布于本港台118kj开奖现场,转载请注明出处:js实现裁剪任意形状图片_php技巧_脚本之家

关键词:

最火资讯