1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

site is looping when chking img thru php functions - need help

Discussion in 'PHP' started by rajnikant, Aug 5, 2008.

  1. #1
    Hi

    My site has thousands of products and lots of images (i.e. around 2.1 lacs ).
    and mostly all things are being done by script ( product import, img upload etc ).

    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 is 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
    Raj
     
    rajnikant, Aug 5, 2008 IP
  2. wdillsmith

    wdillsmith Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Raj-

    Can you just do a directory listing to find the files and skip the database query? I'm not sure I 100% understand why you have an infinite loop, unless you are trying to open files that don't exist without error checking.
     
    wdillsmith, Aug 5, 2008 IP