tailieunhanh - Thiết kế mạng xã hội với PHP - 19

Tham khảo tài liệu 'thiết kế mạng xã hội với php - 19', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Profiles and Statuses return false else l strlen _FILES postfield name - i ext strtolower substr _FILES postfield name i 1 l if in_array ext this- uploadExtentions if in_array _FILES postfield type this- uploadTypes name str_replace _FILES postfield name this- name name_prefix . name path moveto . name_prefix. name move_uploaded_file _FILES postfield tmp_name path this- loadFromFile path return true else invalid type return false else invalid extention return false else not uploaded file return false 162 Download from Wow eBook Chapter 5 Get the image name return String public function getName return this- name When we have finished processing an image the save method finds the appropriate image function for the format of the image and then saves the file. Save changes to an image . after resize param String location location of image param String type type of the image param int quality image quality 100 return void public function save location type quality 100 type type this- type type if type IMAGETYPE_JPEG imagejpeg this- image location quality elseif type IMAGETYPE_GIF imagegif this- image location elseif type IMAGETYPE_PNG imagepng this- image location 163 Download from Wow eBook Profiles and Statuses Back to the controller Now we have an excellent class available to process our profile image uploads which should make things much easier for us let s look at actually allowing the user to edit their profile page with a new function in our profile information controller controllers profile . Edit your profile return void private function editProfile if this- registry- getObject authenticate - isLoggedIn true We first check that the user is logged into the site and if they are we get their user ID. user this- registry- getObject authenticate - getUser - getUserID if isset _POST count _POST 0 If the edit form has been submitted include the model and set the new values. edit form submitted .