item.patch

barbaros, 07/23/2009 11:56 pm

Download (1.4 kB)

item.new.php 2009-07-23 22:49:50.000000000 +0200
105 105
	if($fgFile!='') {
106 106
		$fg = load_image(IMAGE_PATH.$fgFile, $fgColor, $mask_color);
107 107
		if($fg!==false){
108
			imagecopy($bg, $fg, 0, 0, 0, 0, 40, 40);
108
			draw_image($bg, $fg);
109 109
			imagedestroy($fg);
110 110
		}
111 111
	}
......
113 113
	if($i1File!=''){
114 114
		$im=load_image(IMAGE_PATH.$i1File, $i1Color, $mask_color);
115 115
		if($im!==false){
116
			imagecopy($bg, $im, 0, 0, 0, 0, 40, 40);
116
			draw_image($bg, $im);
117 117
			imagedestroy($im);
118 118
		}
119 119
	}
......
121 121
	if($i2File!=''){
122 122
		$im=load_image(IMAGE_PATH.$i2File, $i2Color);
123 123
		if($im!==false){
124
			imagecopy($bg, $im, 0, 0, 0, 0, 40, 40);
124
			draw_image($bg, $im);
125 125
			imagedestroy($im);
126 126
		}
127 127
	}
......
180 180
	return $im;
181 181
}
182 182

183
// draws the src on dst in a 40x40 box aligned at the bottom left
184
function draw_image( $dst, $src ) {
185
	$w = imagesx($src);
186
	$h = imagesy($src);
187
	
188
	// draw at the bottom left
189
	if ( $w != 40 || $h != 40 ) {
190
		imagecopy($dst, $src, 0, 40 - $h, 0, 0, $w, $h);
191
	}
192
	else {
193
		imagecopy($dst, $src, 0, 0, 0, 0, 40, 40);
194
	}
195
}
196

183 197
function colorize($im, $ca, $cr, $cg, $cb){
184 198
	$w=imagesx($im);
185 199
	$h=imagesx($im);