Skip to Content Skip to Menu

Avatar aspect ratio - user crop from x:y to 1:1

2 years 6 months ago - 2 years 6 months ago #329314 by tastyracer
Hi, I'm sure this must be doable and I'm misunderstanding something..
I want all uploaded avatars to be saved as 1:1 aspect ratio, 200px sq max. If user chooses, say, a 2:1 image, they have the possibility to select which part of the image to crop to 1:1

I have the image field's Maximum Image Height and Width set to 200px and enabled Allow Client Resize

If I try to upload a 1200x600px I get the following results:

Maintain Aspect Ratio: No - square 200px image without an option to choose which part of image (as expected)
Maintain Aspect Ratio: Yes - a 200:100px image (as expected)
Maintain Aspect Ratio: Yes with cropping - same as when set to No (so no aspect ratio is being maintained here)
Maintain Aspect Ratio: Yes with user cropping - I get option to select a 1:1 area (looks good...), but when saved I still get a 200:100px image (?)

Could you advise?
Last edit: 2 years 6 months ago by tastyracer.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 6 months ago #329334 by krileon
"Maintain Aspect Ratio" set to "Yes, with User Cropping" is what you're needing. Then adjust the "Maximum Image Height" and "Maximum Image Width" to the size you want the image cropped to. Do the same for "Maximum Thumbnail Height" and "Maximum Thumbnail Width" for the thumbnail. Example as follows.

Maximum Image Height: 200
Maximum Image Width: 200
Maximum Thumbnail Height: 100
Maximum Thumbnail Width: 100
Maintain Aspect Ratio: Yes, with User Cropping
Allow Client Resize: Enable

We don't have a minimum height/width parameter at this time though so you can't for example crop a 100x100 out of a 200x200. It will instead resize then provided cropping if the image overflows.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 6 months ago #329409 by krileon
I was able to find a bug with user cropping that'd cause it to not function as intended.

forge.joomlapolis.com/issues/8947

Fix should be available either today or sometime this week once fix is reviewed and merged. Thank you for letting me know as prompted me to dig into the cropper and make sure it was working right in all cases!


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

2 years 6 months ago #329412 by tastyracer
Replied by tastyracer on topic Avatar aspect ratio - user crop from x:y to 1:1
Ah great, thanks…I thought I was going mad as still couldn’t get it to work!

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 6 months ago #329415 by krileon
Ok, new CB build release is now available. The cropping behavior should properly detect what side of the image needs to be cropped now.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

2 years 6 months ago #329423 by tastyracer
Replied by tastyracer on topic Avatar aspect ratio - user crop from x:y to 1:1
I updated to last CB build but no change. Then I discovered that the problem only manifests when using CB Core Fields Ajax to edit the field - it's fine if I re-enable it to show in Profile Edit.

So I think issue is in CB Core Fields Ajax. I'm using 4.2.0+build.2022.02.08.16.27.40.c7f7b435c which seems to be latest from Feb 22.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum