我有透明的png图像(它是单色的),我应用了colourise php GD过滤器。所以现在它的颜色,但我无法应用白色背景来摆脱透明度。
list($r,$g,$b) = array_map('hexdec',str_split($ColourPrimary,2));
$r = $r - 52;
$g = $g - 52;
$b = $b - 52;
imagesavealpha($im, true);
imagefilter($im, IMG_FILTER_COLORIZE, $r, $g, $b);
$bw = imagesx($im);
$bh = imagesy($im);
$background = imagecreatetruecolor($bw,$bh);
$bkwhite = imagecolorallocate($background, 255, 255, 255);
imagefill($background,0,0,$bkwhite);
imagecopy($background, $im, 0, 0, 0, 0, $bw, $bh);
答案 0 :(得分:1)
$(function(){
$.ajax({
dataType: "json",
url: 'path/to/json/file.json',
success: function(result){
// you can process the JSON result first
// and call other functions after this point
}
});
});