Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php image loading time consumption

Tags:

php

I have a products website where in I have around 100 images of high quality. Each image is around 6-7MB in size.

In my database I have stored the path of all the images along with their names. The images are saved in a folder /images/product_name/, But when I go to display these images in a web page, the page takes forever to load. All I do is send the id to the table, get the image paths and display it in the products page.

It would be very helpful if I could get any sort of advice on how to optimize the process.

like image 639
user1709301 Avatar asked May 29 '26 10:05

user1709301


1 Answers

The images you send to the client are most likely way too big. 7MB of size sounds very large for a product picture so 100*7MB = 700MB of data transfered if you display all the product images.

If you only need small images, scale them down to some KB's (thumbnails) and use those to display in your table.

NOTE: you can just preprend a prefix like "tmb_" or "tmb_200x200_" to the original filename, and you won't have to touch the paths in the database.

like image 189
Gung Foo Avatar answered Jun 04 '26 13:06

Gung Foo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!