Ugh, this is annoying.
So I am trying to use Cloudinary for Angular and the documentation talks about gravity which is great.
https://cloudinary.com/documentation/angular_image_manipulation
So I set up a test:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill" gravity="faces">
</cl-image>
</div>
And this works, sweet.
Then I figured, what happens if I want to do faces or center, depending on a variable. So I added some code:
public gravity: string;
@Input() public useFace: boolean;
constructor() {
this.gravity = this.useFace ? 'faces' : 'center';
}
And I figured I could just update my html to this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill" [gravity]="gravity">
</cl-image>
</div>
which fails with the error:
If 'cl-image' is an Angular component and it has 'gravity' input, then verify that it is part of this module.
not good. So I figured because of the example on the link above uses cl_transformation then I should too. So I did this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill">
<cl-transformation [gravity]="gravity"></cl-transformation>
</cl-image>
</div>
And got this error:
If 'cl-transformation' is an Angular component and it has 'gravity' input, then verify that it is part of this module.
Hmm, so I changed it to this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill">
<cl-transformation gravity="faces"></cl-transformation>
</cl-image>
</div>
Which works.....
So I figured it must be something to do with what's at the bottom of the page, so I changed my html to this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill" [attr.gravity]="gravity">
</cl-image>
</div>
No errors, but not focused on the face. I changed my gravity in the code like this:
public gravity: string = "faces";
constructor() {}
And ran it again, still no errors but not focusing.
Then I changed my html to this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill">
<cl-transformation [attr.gravity]="gravity"></cl-transformation>
</cl-image>
</div>
Again, no errors, but no focused area.
So I tried:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill">
<cl-transformation attr.gravity="{{gravity}}"></cl-transformation>
</cl-image>
</div>
No errors, but not being focused again.
So I then tried this:
<div style="height: 500px; width: 200px;">
<cl-image public-id="brands/fiit_ymk1jy" height="200" width="500" crop="fill" attr.gravity="{{gravity}}">
</cl-image>
</div>
And still no error, but still not focusing.
Does anyone know what I am doing wrong?