Forum Moderators: coopster
My site has thousands of products and lots of their images (i.e. around 2.1 lacs number of images).
While moving img to proper location by script, a few of them have been 0 byte size. so now writing a script to find out all img from the servers whose size is 0 byte. but what happens is when i check if the img exists on the server and the size is 0 byte by php functions like file_get_contents(), file_exist(), filesize() etc. its looping :¦
The reason for this may my img directory has lots of images so after querying my product table, this functions applies for each product in loop and for each iteration it checks whole img directory to perform the operation thats why it keeps looping i think :$
Anybody knows how to resolve this problem, or any other alternative is there which can fulfill my requirement.
Your help will be really appreciated
Thanks
Are you sure you are looping and hanging or is it just that your server is still processing the large amount of data? One way to find out is to flush() [php.net] the data to the browser to find out. Start with a smaller subset in your loop (for example, create a counter and exit the loop after the first 20 entries processed or something). Once you have the logic good and sound, remove the limiter and set_time_limit [php.net] to zero so your script can roll through and do it's work.