Skip to content

Commit

Permalink
Implement JS function to automatically replace users' broken pictures…
Browse files Browse the repository at this point in the history
… with default user image
  • Loading branch information
marcopernpruner committed Aug 7, 2023
1 parent 1240a6e commit 0f819cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _includes/list-people.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
{% if personImage != "" %}
<div class="card-image">
<figure class="image">
<img src="{{ personImage }}" alt="{{ person.surname }} {{ person.name }}" />
<img src="{{ personImage }}" alt="{{ person.name }} {{ person.surname }}" onError="setDefaultUserPicture(this)" />
</figure>
</div>
{% endif %}
Expand Down
5 changes: 5 additions & 0 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ $('a').each(function() {
}
});

function setDefaultUserPicture(picture) {
picture.src = "/assets/images/no-user.jpg";
return true;
}

function iframe16vs9() {
var iframes = $("iframe");

Expand Down

0 comments on commit 0f819cd

Please sign in to comment.