Code Monkey home page Code Monkey logo

Comments (8)

ayushn21 avatar ayushn21 commented on July 20, 2024 1

Hi @dannysood,

I considered this case when I originally wrote the library. I decided not to support it at the time because I couldn't think of a reason why a user would not lock the height equal to the width in AutoLayout if they wanted a circular profile picture.

I am still not keen on having this functionality in as I don't think it is required and would be unnecessary bloat in my opinion. Code would be required to compute the square in which to draw the circle and then centre it within the rectangular bounds. Fairly trivial logic, but no point in adding unnecessary code in!

Could you please explain what your use case is for which you would need this functionality?

Thanks,
Ayush

from avatarimageview.

ayushn21 avatar ayushn21 commented on July 20, 2024 1

No worries, I'll try investigating myself when I get some time. I'll leave it open in case someone else encounters the same issue :)

from avatarimageview.

dannysood avatar dannysood commented on July 20, 2024

The reason I faced this issue is because I am trying to fetch images from social networks which may or may not be perfect squares. A lot of platforms allow you to upload pictures in any dimension and then select a part of it to show as thumbnail. As a result when such images are pulled and without the metadata of where the square thumbnail is its difficult to exactly how to draw the square thumbnail that can be converted to perfect circle. Doing aspect fit instead of aspect fill inside the circle when its drawn takes care of such scenarios in easy way. A lot of apps dont really want to complicate user flow and forcing user to select a dp in a cropping tool as a first step is a extra avoidable step when onboarding new customers which already is an expensive process.

from avatarimageview.

dannysood avatar dannysood commented on July 20, 2024

I think I can figure out a way around it but this is something that other users may also feel and might expect this to be available as I expected. :)

from avatarimageview.

ayushn21 avatar ayushn21 commented on July 20, 2024

Ah I see what you mean, you're referring to the dimensions of the image, not the ImageView.

I agree that a cropping tool is an extra avoidable step. Setting the image resizing to Aspect Fill would expand the image to fill the bounds of the ImageView, after which the circle shape would appear correctly.

This is something I would like to leave in control of the user though; in my opinion it is not within the scope of the library to handle those settings.

What are you thoughts on this? Is there a code change in the library code that you have in mind to work around this issue?

from avatarimageview.

dannysood avatar dannysood commented on July 20, 2024

Setting the image resizing to Aspect Fill would expand the image to fill the bounds of the ImageView, after which the circle shape would appear correctly. This for some reason hasnt worked properly for me and I thought that this property was being bypassed somehow. THe image is always in aspectfit. The only special case here is that the uiimage is inside a stackview maybe that is to blame?

from avatarimageview.

ayushn21 avatar ayushn21 commented on July 20, 2024

Ah, that's strange. I don't see why the Stack View should be a problem. I'm not setting the scaling mode anywhere inside the library. Could you please extract the bit of code you're facing a problem with into a sample project and upload it? It would help me investigate and diagnose the problem. Thanks!

from avatarimageview.

dannysood avatar dannysood commented on July 20, 2024

Ill need some time for that. I am on a pretty tight deadline. You can go ahead and close this for now but I will get back to this with an update and we can reopen and debug it then.

from avatarimageview.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.