Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: phranque
I recently redesigned a site for a customer who has an online ecommerce site.
He now has a database driven site, with over 2,000 products. 75% of them products require "sample" files as well as images of the product. I have the site setup similarly to this:
images (2.3Mb total with 113 files in folder).
images/products (23.7Mb total with 2092 files in folder).
images/products/thumbs (3.8Mb total with 1025 files in folder).
samples (2.2Gb total with 3,214 files in folder).
As you can see the samples folder contains a lot of files and is 2.2Gb in size!. Now I can use ws_ftp to connect to the site, and browse more or less all the folders, however if I try to browse to html_root/images/products, html_root/images/products/thumbs or html_root/samples, then it takes ages to "think" about it and displays an empty folder (and I know it's not as the webpage displays the product info / images / samples.
This however means the client can no longer open the folder to upload further product images / samples etc!
Now I don't know what to do with regards to this, and would like some advice on what to do? I have spoken to my host and they say I am right, the FTP server is timing out whilst it trys to list the directory, due to the size of files, qty of files etc.
What can anyone suggest?
It was a VPS, so I was able to change the setting and see all my files. If you're on shared hosting, I don't know if that's something they would be willing to change for you.
Or it might be exactly what it looks like -- a simple timeout when your program attempts to get the entire directory listing. Have you tried any other ftp programs to see if you can get the actual directory listing?
I am currently using ws_ftp as the client.
I was thinking of moving all the images into seperate folders like so
html_root/images/products/00000 (contains imgs for 1st 1000 products)
html_root/images/products/01000 (contains imgs for 2nd 1000 products)
html_root/images/products/02000 (contains imgs for 3rd 1000 products)
html_root/images/products/03000 (contains imgs for 4th 1000 products)
html_root/images/products/04000 (contains imgs for 5th 1000 products)
I was then thinking of using .htaccess to take each request for images in the original html_root/images/products/ folder and use a php script to 'serve' that image. This would work in the following:-
.htaccess takes the request and passes info on to following script:-
The php script would look at the product_id, look in the relevant folder for it, and the read the file before outputting it (don't know how to do this regarding headers etc).
Can anyone see a problem with doing it this way?
If I have a page which displays 20 products per page, will this cause issues (1.5kb for each thumbnail, requested 20 times = much additional server load?).