Comments (8)
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.
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.
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.
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.
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.
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.
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.
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)
- Swift 3 support! HOT 2
- EXC_BAD_Access HOT 5
- Swift 3 HOT 9
- Image Isn't Rounded HOT 2
- Swift 4 HOT 5
- Image for UIButton HOT 1
- Carthage support HOT 1
- Add white border HOT 1
- Installing manually instead of with Pods HOT 1
- Border on Avatar view? HOT 3
- Not working!? HOT 1
- How to create AvatarImageView pragmatically? HOT 1
- How Can I make it clickable? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avatarimageview.