Skip to content

Commit

Permalink
Improved home page loading speed
Browse files Browse the repository at this point in the history
Main contributing factor to images not loading fast was content download time (~30s) rather than queuing or waiting for a response (2-3s). Hence set one image to always display first and compressed images
  • Loading branch information
Wozunubi committed Jun 21, 2024
1 parent 9d0a23e commit 0d8a217
Show file tree
Hide file tree
Showing 22 changed files with 15 additions and 14 deletions.
Binary file removed client/src/assets/homeSlideshow/DSC_0309.webp
Binary file not shown.
Binary file not shown.
Binary file removed client/src/assets/homeSlideshow/DSC_0411.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed client/src/assets/homeSlideshow/IMG_9541.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed client/src/assets/homeSlideshow/NINU2-350-4K.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions client/src/pages/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ const HomePageSlideshow = () => {
src={image.src}
placeholder={image.placeholder}
alt={'slideshow' + index}
loading="lazy"
/>
</div>
))}
Expand Down
28 changes: 14 additions & 14 deletions client/src/pages/Home/functions.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import useAxios from '../../hooks/useAxios.jsx';
const { axios } = useAxios();

import slideshow2 from '../../assets/homeSlideshow/NINU2-350-4K.jpg';
import slideshow1 from '../../assets/homeSlideshow/DSC_0309.webp';
import slideshow3 from '../../assets/homeSlideshow/DSC_0411.webp';
import slideshow4 from '../../assets/homeSlideshow/EgeFeyzioglu_Phi (264)-4K.jpg';
import slideshow5 from '../../assets/homeSlideshow/Erin_Sigma_CheerOff (30)-4K.jpg';
import slideshow6 from '../../assets/homeSlideshow/IMG_9541.webp';
import slideshow7 from '../../assets/homeSlideshow/MithunVanniasinghe_Omega-0422-4K.jpg';
import slideshow8 from '../../assets/homeSlideshow/NatalieChan_Gamma (7)-4K.jpg';
import slideshow9 from '../../assets/homeSlideshow/ZarehMarkarian_Chi_04649-XL.jpg';
import slideshow10 from '../../assets/homeSlideshow/VedantGupta_Pi-7292-4K.jpg';
import slideshow1 from '../../assets/homeSlideshow/NatalieChan_Gamma (7)-X3.webp';
import slideshow2 from '../../assets/homeSlideshow/DSC_0309_reduced.webp';
import slideshow3 from '../../assets/homeSlideshow/DSC_0411_reduced.webp';
import slideshow4 from '../../assets/homeSlideshow/EgeFeyzioglu_Phi (264)-X3.webp';
import slideshow5 from '../../assets/homeSlideshow/Erin_Sigma_CheerOff (30)-X3.webp';
import slideshow6 from '../../assets/homeSlideshow/IMG_9541_reduced.webp';
import slideshow7 from '../../assets/homeSlideshow/MithunVanniasinghe_Omega-0422-X3.webp';
import slideshow8 from '../../assets/homeSlideshow/NINU2-350-X3.webp';
import slideshow9 from '../../assets/homeSlideshow/ZarehMarkarian_Chi_04649-X3.webp';
import slideshow10 from '../../assets/homeSlideshow/VedantGupta_Pi-7292-X3.webp';

import slideshowTiny1 from '../../assets/homeSlideshow/tiny/NINU2-350-4K.jpg';
import slideshowTiny1 from '../../assets/homeSlideshow/tiny/NatalieChan_Gamma (7)-4K.jpg';
import slideshowTiny2 from '../../assets/homeSlideshow/tiny/DSC_0309.webp';
import slideshowTiny3 from '../../assets/homeSlideshow/tiny/DSC_0411.webp';
import slideshowTiny4 from '../../assets/homeSlideshow/tiny/EgeFeyzioglu_Phi (264)-4K.jpg';
import slideshowTiny5 from '../../assets/homeSlideshow/tiny/Erin_Sigma_CheerOff (30)-4K.jpg';
import slideshowTiny6 from '../../assets/homeSlideshow/tiny/IMG_9541.webp';
import slideshowTiny7 from '../../assets/homeSlideshow/tiny/MithunVanniasinghe_Omega-0422-4K.jpg';
import slideshowTiny8 from '../../assets/homeSlideshow/tiny/NatalieChan_Gamma (7)-4K.jpg';
import slideshowTiny8 from '../../assets/homeSlideshow/tiny/NINU2-350-4K.jpg';
import slideshowTiny9 from '../../assets/homeSlideshow/tiny/ZarehMarkarian_Chi_04649-XL.jpg';
import slideshowTiny10 from '../../assets/homeSlideshow/tiny/VedantGupta_Pi-7292-4K.jpg';

Expand Down Expand Up @@ -79,8 +79,8 @@ export function getSlideshowImages() {
}

function shuffleArray(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
for (let i = array.length - 1; i > 1; i--) {
const j = Math.floor(Math.random() * i) + 1;
[array[i], array[j]] = [array[j], array[i]];
}
return array;
Expand Down

0 comments on commit 0d8a217

Please sign in to comment.