Skip to:
Content

BuddyPress.org

Opened 9 years ago

Last modified 3 months ago

#6746 new defect (bug)

Avatar filename could generate: "There was a problem cropping your avatar"

Reported by: sgr33n's profile SGr33n Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Media Keywords: needs-patch good-first-bug
Cc: emaralive

Description

Hi people :)

If you try to reupload an avatar previously downloaded from BP it returns error: "There was a problem cropping your avatar".

Despite of the generic message error, it's related to the filename, looks like returns this when the filename ends by -bpfull and -bpthumb.

Change History (10)

#1 @DJPaul
9 years ago

This sounds familiar. There might be some old ticket, or perhaps the issue has been reported/investigated before somewhere.

@SGr33n are you sure it's to do with the filename extension? Did you test?

#2 @SGr33n
9 years ago

Hi DjPaul,

I know there was an old issue about the filename lenght (I suppose fixed now), but this looks never reported. I also tried with -bpcustom.jpg and the upload works good, the only not working two I found are -bpthumb.* and -bpfull.* (the suffix used by BP). I tested it removing the suffix and the upload works, nothing related to the lenght, because i tried also to replace the -bpfull with 1234567 and it still work.

Example of filename not working 12345-bpfull.jpg
Example of filename working 123456789012.jpg

#3 @imath
9 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.5

That's probably due to the fact we need to remove the previously uploaded avatar when cropping. We are using bp_core_delete_existing_avatar() to do so which is removing files containing -bpthumb & -bpfull into their name. A possible way to fix this is to rename (stripping from its name -bpthumb & -bpfull) the file during the upload.

It's not something that happened since 2.4, so i think we can work on it for 2.5.

#4 @boonebgorges
9 years ago

That's probably due to the fact we need to remove the previously uploaded avatar when cropping. We are using bp_core_delete_existing_avatar() to do so which is removing files containing -bpthumb & -bpfull into their name. A possible way to fix this is to rename (stripping from its name -bpthumb & -bpfull) the file during the upload.

This looks right to me, and I agree that renaming the file during the upload is probably the correct fix. We end up renaming the file anyway using wp_hash(), so there's no harm in renaming earlier too.

#5 @SGr33n
9 years ago

That's absolutely a solution, but I think the best way may be to load the temporary image on the browser cache via javascript and then upload the final image once cropped on the server. Infact could happen that the user doesn't crop the image after he uploaded it, and that temporary file will not deleted. This solution could also optimize the server usage, I made this before on a BP Cover Plugin.

#6 @DJPaul
9 years ago

  • Keywords good-first-bug added

#7 @DJPaul
9 years ago

  • Milestone changed from 2.5 to 2.6

#8 @DJPaul
9 years ago

  • Milestone changed from 2.6 to Future Release

#9 @DJPaul
8 years ago

  • Component changed from API - Avatars to Media

#10 @emaralive
3 months ago

  • Cc emaralive added
Note: See TracTickets for help on using tickets.