def icon_crop(): import util icon_path = "/home/meego/Desktop/dd.jpg" user_id = 2006 coords = "200|100|200|200" response = util.icon_crop(user_id, icon_path, coords) for param in response: print response[param]
def post(self): coords = self.get_argument("coords") file_path = self.get_argument("file_path") tmp = "%s/%s" % (self.settings["icon_dir"], file_path) response = icon_crop(self.current_user["_id"], tmp, coords) if not response["status"]: self.render("account/crop.html", error=152, file_path=file_path) return photo_path = response["photo_path"].split("/icons/")[1] middle_path = response["middle_path"].split("/icons/")[1] user = self.current_user user["photo_url"] = photo_path user["middle_photo_url"] = middle_path result = self.user_dal.update_user(user) if result: self.render("account/crop.html", error=152, file_path=file_path) return self.redirect("/settings/icon")