Discuz! profile pictures are always uploaded in Flash, and you can't change the language pack or style. Here's how to change them to HTML5:
- Add the relevant language to the language pack: Add the following to source/language/home/lang_template.php
'back_file_selection' => 'Return to select again', 'upload_succeed' => 'Upload successful!', 'three_avatars' => 'These are the three sizes of your avatar',
- Modify the uploaded template: template/default/home/spacecp_avatar.htm
- Modify file processing script
Modified file download:avatar_160104a
Upload profile picture process:
Existing processes
1) Profile Picture Editing Webpage![]() | The profile picture editing webpage was obtained from the following request: GET /home.php?mod=spacecp&ac=avatar The script file that handles the requests is source/include/spacecp/spacecp_avatar.php, while the webpage format is defined in the template file template/default/home/spacecp_avatar.htm. This webpage contains a Flash animation uc_server/images/camera.swf, providing avatar editing client functionality. GET /uc_server/images/camera.swf?inajax=1&appid=1&input=201eHYPCqwF… |
2) Upload profile picture![]() | The selection and uploading of avatar files are provided by the Flash animation camera.swf. It sends the following request to the server, which includes the content of the avatar file: POST /uc_server/index.php?m=user&inajax=1&a=uploadavatar&appid=1&input=201eHYPCqwF… This request is handled by the function `onuploadavatar` in the script file `uc_server/control/user.php`. It saves the file on the server and sends the file's path back to the Flash animation `camera.swf`. |
3) Crop the portrait![]() | The image scaling and cropping functionality is provided by the Flash animation camera.swf. After clicking the OK button, the Flash animation sends the following request to the server: POST /uc_server/index.php?m=user&inajax=1&a=rectavatar&appid=1&input=201eHYPCqwF… urlReaderTS=1451947309935&avatar1=FFD8FFE000104A4649460001… The request contained profile pictures in three sizes (small, medium, and large) after cropping. The script file uc_server/control/user.php on the server processed this request and saved the uploaded profile pictures. |
4) Display avatar![]() | The display of the three avatar sizes is also provided by the Flash animation camera.swf. |
New process
The revised profile picture editing process is as follows:
1) Profile Picture Editing Webpage![]() | The profile picture editing webpage was obtained from the following request: GET /home.php?mod=spacecp&ac=avatar The script file that handles the requests is source/include/spacecp/spacecp_avatar.php, while the webpage format is defined in the template file template/default/home/spacecp_avatar.htm. This webpage contains several canvases and provides avatar editing client functionality. GET /uc_server/images/camera.swf?inajax=1&appid=1&input=201eHYPCqwF… |
2) Upload profile picture![]() | The selection and uploading of profile picture files are provided by the `file` element in the HTML. It sends the following request to the server, which includes the content of the profile picture file: POST /uc_server/index.php?m=user&inajax=1&a=uploadavatar&appid=1&input=201eHYPCqwF… This request is handled by the function `onuploadavatar` in the script file `uc_server/control/user.php`. It saves the file on the server and sends the file's path back to the client. |
3) Crop the portrait![]() | Image scaling and cropping functionality is provided by a combination of the canvas and drag-and-drop widgets in jQuery UI. After clicking the OK button, the client sends the following request to the server: POST /uc_server/index.php?m=user&inajax=1&a=rectavatar&appid=1&input=201eHYPCqwF… ——WebKitFormBoundary7I7NlBxh4ycJkBD8 Content-Disposition: form-data; name=”avatar1″ /9j/4AAQSkZJRgABAQAAAQABAAD… The request contained profile pictures in three sizes (small, medium, and large) after cropping. The script file uc_server/control/user.php on the server processed this request and saved the uploaded profile pictures. |
4) Display avatar![]() | The display of the three avatar sizes is also provided by the canvas. |
Original article from: Beyond.net
This siteOriginal articleAll follow "Attribution-NonCommercial-ShareAlike 4.0 License (CC BY-NC-SA 4.0)Please retain the following annotations when sharing or adapting:
Original author:Jake Tao,source:"Change the uploaded profile picture to a non-Flash version in Discuz"
