Beispiel #1
0
        //testing APIs
        public bool ReceiveFile(byte[] imageArray)
        {
            Image img = Universal.ByteArrayToImage(imageArray);

            Output.ShowImage(img);
            return(true);
        }
Beispiel #2
0
        public JObject ChangeProfileImage(long userId, byte[] imageArray)
        {
            Output.ShowLog("ChangeProfileImage() => " + userId);
            Image  img             = new Bitmap(GraphicsStudio.ClipToCircle(Universal.ByteArrayToImage(imageArray)), new Size(200, 200));
            string newProfileImgId = "DP_" + userId + "_" + Time.CurrentTime.TimeStampString;
            string oldProfileImgId = ConsumerRepository.Instance.ReassignConsumerProfileImgId(userId, newProfileImgId);

            if (oldProfileImgId != null && oldProfileImgId.Length >= 5)
            {
                ImageFileAccess.EraseProfileImage(oldProfileImgId);
            }
            JObject profileImgIdJson = new JObject();

            profileImgIdJson["old_image_id"] = null;
            profileImgIdJson["new_image_id"] = null;
            if (ImageFileAccess.SaveProfileImage(img, newProfileImgId))
            {
                profileImgIdJson["old_image_id"] = oldProfileImgId;
                profileImgIdJson["new_image_id"] = newProfileImgId;
                Output.ShowLog(profileImgIdJson);
            }
            return(profileImgIdJson);
        }