konnwat Posted February 12, 2007 Share Posted February 12, 2007 Im confused. I've got a 10 png images, with aplha, of the numbers 0-9 they all have the same hight but not the same width. I got a mysql database with a counter number and i made a counter works fine, but its not in aplha :s heres my code... <?php //str_split if(!function_exists('str_split')){ function str_split($string,$split_length=1){ $count = strlen($string); if($split_length < 1){ return false; } elseif($split_length > $count){ return array($string); } else { $num = (int)ceil($count/$split_length); $ret = array(); for($i=0;$i<$num;$i++){ $ret[] = substr($string,$i*$split_length,$split_length); } return $ret; } } } //connect to mysql $mysqlLink = mysql_connect(----------------); mysql_select_db(--------------); //get id if(isset($_GET['id'])) { $id = $_GET['id']; } else { $id = '1'; } //get count number and +1 $result = mysql_query("SELECT * FROM counters WHERE ID=".$id); $rows = mysql_fetch_array($result); $count = $rows['Count']; if ($_COOKIE[$id] != 'done') { $count++; mysql_query("UPDATE counters SET Count = '$count' WHERE ID=".$id); //set cookie setcookie($id, 'done', time()+60); } //split the count $numbers = str_split($count); $digits = count($numbers); $nextwidth = 0; //make image header ("Content-type: image/png"); for($i=0; $i<$digits; $i++) { list($width, $height, $type, $attr) = getimagesize("numbers/{$rows['Type']}/{$numbers[$i]}.png"); $nextwidth += $width; } $im = imagecreate($nextwidth, $height); imagesavealpha($im, true); $nextwidth = 0; imagecolorallocate($im, 0, 0, 0); for($i=0; $i<$digits; $i++) { list($width, $height, $type, $attr) = getimagesize("numbers/{$rows['Type']}/{$numbers[$i]}.png"); $image[$i] = imagecreatefrompng("numbers/{$rows['Type']}/{$numbers[$i]}.png"); imagesavealpha($image[$i], true); imagecopymerge($im,$image[$i], $nextwidth, 0, 0, 0, $width, $height, 100); $nextwidth += $width; } imagesavealpha($im, true); imagepng($im); ?> i have imagesavealpha($im, true); in 3 times, i tried it everywhere :s please help thanks Link to comment https://forums.phpfreaks.com/topic/38195-php-gd-alpha/ Share on other sites More sharing options...
konnwat Posted February 12, 2007 Author Share Posted February 12, 2007 Please someone Link to comment https://forums.phpfreaks.com/topic/38195-php-gd-alpha/#findComment-183118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.