I recommended an open-source flash Avatar Upload component two days ago. today I added this component to the codeigniter framework. The biggest feature of this component is ease of use. of course, if you want to modify some of the features, you may need to contact the plug-in author for customization.
I recommended an open-source flash Avatar Upload component two days ago. today I added this component to the codeigniter framework. The biggest feature of this component is ease of use. of course, if you want to modify some of the features, you may need to contact the plug-in author for customization.
The following describes how to deploy the flash Avatar Upload component in the codeigniter framework:
1. Controller controllers
// Modify the public function avatar () {$ result = $ this-> userinfo_model-> get_user_base_info_by_uid ($ this-> uid); $ data = array (); $ data ['Avatar '] = $ this-> default_avatar; if ($ result [0]-> avatar! = '') {$ Data ['Avatar '] = base_url (). "uploads/users/avatar/{$ this-> uid}/{$ this-> uid1__big.png" ;}$ this-> view ('userinfo/avatar ', $ data);} // public function doavatar () {error_reporting (0); // Set the Avatar storage directory $ webroot = $ _ SERVER ['document _ root']; $ save_path = "{$ webroot}/uploads/users/avatar/{$ this-> uid}/"; if (! File_exists ($ save_path) {mkdir ($ save_path, 0777, true);} $ file_src = "src.png "; $ filename162 = "{$ save_path} {$ this-> uid1__big.png"; $ filename48 = "{$ save_path} {$ this-> uid1__middle.png "; $ filename20 = "{$ save_path} {$ this-> uid1__small.png"; $ src = base64_decode ($ _ POST ['Pic ']); $ pic1 = base64_decode ($ _ POST ['pic1']); $ pic2 = base64_decode ($ _ POST ['pic2']); $ pic3 = base64_decode ($ _ POST ['pic3']); if ($ src) {file_put_contents ($ file_src, $ src);} file_put_contents ($ filename162, $ pic1 ); file_put_contents ($ filename48, $ pic2); file_put_contents ($ filename20, $ pic3); $ data = array (); $ data ['Avatar '] = $ this-> uid; $ result = $ this-> userinfo_model-> update_user_by_uid ($ this-> uid, $ data); if ($ result) {$ rs ['status'] = 1; echo json_encode ($ rs );}}
2. View views