-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Avatar Issue #236
Avatar Issue #236
Conversation
I'm looking to see why the build failed |
app/Models/User.php
Outdated
/** | ||
* Return a File model | ||
*/ | ||
public function getAvatarAttribute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need this so we can call $user->avatar->url
, which will form the correct URL (look at Models/File.php
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s me check again to make other commit please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. It's just so the URL is formed correctly and if they want to use the Laravel file storage going to a different place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see File model, so that logic didn't make me sense, but now I have corrected these lines.
<div class="input-group form-group-no-border{{ $errors->has('avatar') ? ' has-danger' : '' }}"> | ||
{{ Form::file('avatar', null) }} | ||
</div> | ||
<p class="small">This avatar will be rezise to {{ config('phpvms.avatar.width'). ' x '. config('phpvms.avatar.height') }}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should read as "resized"
@if ($user->avatar == null) | ||
<img src="{{ $user->gravatar(512) }}" style="width: 123px;"> | ||
@else | ||
<img src="{{ url($user->avatar) }}" style="width: 123px;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be $user->avatar->url
. Or public_asset($user->avatar)
, if the path to the profile image is uploads/avatar/
etc
Can you also comment out this line: |
refactoring other methods this will work
corrected string
Changed src call for user avatar, this will return the correct url based on avatar attribute of User Model
corrected the path to user avatar based on get avatar attribute on user model
Should work now |
Resize method only works with numbers as a parameter, is not necessary to put px at the end.
Added the logic to set avatar to user