Skip to content

Commit

Permalink
fix: load image from correct device ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Oct 27, 2023
1 parent 03874dd commit 4d2ecc8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions components/home/HomeSectionContributors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ onMounted(async () => {
onBeforeUnmount(stopTimer)
const $contributors = computed(() => contributors.value.length ? contributors.value.slice(start.value, start.value + total) : new Array(total).fill(null))
function imgUrl (username) {
return `https://ipx.nuxt.com/f_auto,s_80x80/gh_avatar/${username}`
}
function startTimer (ms = 5000) {
currentTimeout = setTimeout(nextContributors, ms)
}
Expand All @@ -43,7 +40,7 @@ function stopTimer () {
async function loadImages (usernames) {
await Promise.all(usernames.map(username => {
const img = new Image()
img.src = imgUrl(username)
img.src = `https://ipx.nuxt.com/f_auto,s_${window.devicePixelRatio === 2 ? '160x160' : '80x80'}/gh_avatar/${username}`
return new Promise(resolve => {
img.onload = resolve
img.onerror = resolve
Expand Down

0 comments on commit 4d2ecc8

Please sign in to comment.