|
@@ -32,6 +32,7 @@ function store_skin(rid, userId, profile, cache_details, callback) {
|
|
|
logging.log(rid, "new skin hash:", skin_hash);
|
|
|
var facepath = path.join(__dirname, "..", config.faces_dir, skin_hash + ".png");
|
|
|
var helmpath = path.join(__dirname, "..", config.helms_dir, skin_hash + ".png");
|
|
|
+ var skinpath = path.join(__dirname, "..", config.skins_dir, skin_hash + ".png");
|
|
|
fs.exists(facepath, function(exists) {
|
|
|
if (exists) {
|
|
|
logging.log(rid, "skin already exists, not downloading");
|
|
@@ -41,16 +42,23 @@ function store_skin(rid, userId, profile, cache_details, callback) {
|
|
|
if (err1 || !img) {
|
|
|
callback(err1, null);
|
|
|
} else {
|
|
|
- skins.extract_face(img, facepath, function(err2) {
|
|
|
- if (err2) {
|
|
|
- logging.error(rid, err2.stack);
|
|
|
- callback(err2, null);
|
|
|
+ skins.save_image(img, skinpath, function(skin_err) {
|
|
|
+ if (skin_err) {
|
|
|
+ logging.error(rid, skin_err);
|
|
|
+ callback(skin_err, null);
|
|
|
} else {
|
|
|
- logging.debug(rid, "face extracted");
|
|
|
- skins.extract_helm(rid, facepath, img, helmpath, function(err3) {
|
|
|
- logging.debug(rid, "helm extracted");
|
|
|
- logging.debug(rid, helmpath);
|
|
|
- callback(err3, skin_hash);
|
|
|
+ skins.extract_face(img, facepath, function(err2) {
|
|
|
+ if (err2) {
|
|
|
+ logging.error(rid, err2.stack);
|
|
|
+ callback(err2, null);
|
|
|
+ } else {
|
|
|
+ logging.debug(rid, "face extracted");
|
|
|
+ skins.extract_helm(rid, facepath, img, helmpath, function(err3) {
|
|
|
+ logging.debug(rid, "helm extracted");
|
|
|
+ logging.debug(rid, helmpath);
|
|
|
+ callback(err3, skin_hash);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
});
|