Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // [START] At last, create the PNG image!
- //
- $tot_width = $width;
- $tot_height = $height;
- // Get all layers in the correct order!
- $Lsql = "SELECT * FROM `".$table_prefix."nulavatar_layers` ORDER BY position ASC";
- if ( !($Lresult = $db->sql_query($Lsql)) )
- { message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br><br>".mysql_error()); }
- $tot_layers = mysql_num_rows($Lresult);
- $nulavatar = false;
- for( $iii = 0; $iii < $tot_layers; $iii++ )
- {
- $Lrow = mysql_fetch_array($Lresult);
- if($HTTP_POST_VARS[$Lrow['name']] != 'spacer.gif')
- {
- if($nulavatar == false)
- {
- $sprite_1 = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
- $nulavatar = true;
- }
- else
- {
- $image = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
- @imagecopy ($sprite_1, $image, 0, 0, 0, 0, $tot_width, $tot_height);
- @ImageDestroy($image);
- }
- }
- }
- imagesavealpha($sprite_1, true);
- imagealphablending($sprite_1, false);
- $save = $userdata['user_id'];
- $flip = imagecreatetruecolor($tot_width, $tot_height);
- imagealphablending($flip, false);
- imagesavealpha($flip, true);
- // Do the flip
- imagecopyresampled($flip, $sprite_1, 0, 0, $tot_width, 0, $tot_width, $tot_height, -$tot_width, $tot_height);
- imagepng($sprite_1, $phpbb_root_path . $chars_path . '/' . $save . '.png');
- imagepng($flip, $phpbb_root_path . $chars_path . '/' . $save . '_flip.png');
- imagedestroy($sprite_1);
- imagedestroy($flip);
- //
- // [END] At last, create the PNG image!
- //
Add Comment
Please, Sign In to add comment