Opened 13 years ago
Closed 7 years ago
#3958 closed enhancement (maybelater)
Allow return of WP_Error object from bp_core_avatar_handle_crop for better error messages
Reported by: | drhodesmumby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.5.3 |
Component: | Core | Keywords: | needs-patch, trac-tidy-2018 |
Cc: |
Description
Well, it's in the title.
If wp_crop_image fails for whatever reason (in my case because I didn't have the gd image library installed) then Buddypress silently ignores it and declares the upload and cropping process of an avatar to be successful nonetheless.
The issue is in bp-core/bp-core-avatars.php on lines 548-554, which attempt to use wp_crop_image without handling any errors returned:
// Crop the image $full_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_full_width(), bp_core_avatar_full_height(), false, $avatar_folder_dir . '/' . $full_filename ); $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, bp_core_avatar_thumb_width(), bp_core_avatar_thumb_height(), false, $avatar_folder_dir . '/' . $thumb_filename ); // Remove the original @unlink( $original_file ); return true;
Ideally Buddypress would handle the error returned by wp_crop_image and report it to the user.
Change History (5)
#3
@
13 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Severity changed from major to normal
- Summary changed from Errors returned from wp_crop_image during avatar upload are not handled, resulting in silent failure to Allow return of WP_Error object from bp_core_avatar_handle_crop for better error messages
- Type changed from defect (bug) to enhancement
#4
@
7 years ago
- Keywords trac-tidy-2018 added
We're closing this ticket because it has not received any contribution or comments for at least two years. We have decided that it is better to close tickets that are good ideas, which have not gotten (or are unlikely to get) contributions, rather than keep things open indefinitely. This will help us share a more realistic roadmap for BuddyPress with you.
Everyone very much appreciates the time and effort that you spent sharing your idea with us. On behalf of the entire BuddyPress team, thank you.
If you feel strongly that this enhancement should still be added to BuddyPress, and you are able to contribute effort towards it, we encourage you to re-open the ticket, or start a discussion about it in our Slack channel. Please consider that time has proven that good ideas without contributions do not get built.
For more information, see https://bpdevel.wordpress.com/2018/01/21/our-awaiting-contributions-milestone-contains/
or find us on Slack, in the #buddypress channel: https://make.wordpress.org/chat/
I'm going to commit a change so it checks the return value, and returns false if an error occurs. This ticket can then remain open for a future release to make changes throughout so we can return a WP_Error object from bp_core_avatar_handle_crop() itself, which will then let us build in more specific error messages.