Guest User

Untitled

a guest
Jul 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. //
  2. // [START] At last, create the PNG image!
  3. //
  4. $tot_width = $width;
  5. $tot_height = $height;
  6.  
  7. // Get all layers in the correct order!
  8. $Lsql = "SELECT * FROM `".$table_prefix."nulavatar_layers` ORDER BY position ASC";
  9. if ( !($Lresult = $db->sql_query($Lsql)) )
  10. { message_die(GENERAL_MESSAGE, "<b>Fatal Error!</b><br><br>".mysql_error()); }
  11.  
  12. $tot_layers = mysql_num_rows($Lresult);
  13.  
  14. $nulavatar = false;
  15.  
  16. for( $iii = 0; $iii < $tot_layers; $iii++ )
  17. {
  18. $Lrow = mysql_fetch_array($Lresult);
  19. if($HTTP_POST_VARS[$Lrow['name']] != 'spacer.gif')
  20. {
  21. if($nulavatar == false)
  22. {
  23. $sprite_1 = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
  24. $nulavatar = true;
  25. }
  26. else
  27. {
  28. $image = @$imagecreate($phpbb_root_path.$sprites_path.'/'.$HTTP_POST_VARS[$Lrow['name']]);
  29. @imagecopy ($sprite_1, $image, 0, 0, 0, 0, $tot_width, $tot_height);
  30. @ImageDestroy($image);
  31. }
  32. }
  33. }
  34.  
  35. imagesavealpha($sprite_1, true);
  36. imagealphablending($sprite_1, false);
  37. $save = $userdata['user_id'];
  38.  
  39. $flip = imagecreatetruecolor($tot_width, $tot_height);
  40.  
  41. imagealphablending($flip, false);
  42. imagesavealpha($flip, true);
  43.  
  44. // Do the flip
  45. imagecopyresampled($flip, $sprite_1, 0, 0, $tot_width, 0, $tot_width, $tot_height, -$tot_width, $tot_height);
  46.  
  47. imagepng($sprite_1, $phpbb_root_path . $chars_path . '/' . $save . '.png');
  48.  
  49. imagepng($flip, $phpbb_root_path . $chars_path . '/' . $save . '_flip.png');
  50.  
  51. imagedestroy($sprite_1);
  52. imagedestroy($flip);
  53.  
  54. //
  55. // [END] At last, create the PNG image!
  56. //
Add Comment
Please, Sign In to add comment