Results 1 to 8 of 8
  1. #1
    Affiliate Manager PetsWarehouse.com's Avatar
    Join Date
    January 17th, 2005
    Location
    Long Island, New York
    Posts
    1,616
    Need to test image urls
    Is there a way to test a bunch (like 10,000) of image urls to test them for broken links?
    Bob Pets Warehouse
    Worlds Largest Pet Supply DataBase
    Join our Share-A-Sale Program [since 2003] Twitter



  2. #2
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    spider them

  3. #3
    Affiliate Manager buyjewelry's Avatar
    Join Date
    January 18th, 2005
    Posts
    400
    I'm sure there is a more efficient way than this, but it's quick and dirty...

    Create a webpage from a csv file (or similar) and quickly eye-ball the broken images.

  4. #4
    http and a telephoto
    Join Date
    January 18th, 2005
    Location
    NYC
    Posts
    17,708
    Quote Originally Posted by buyjewelry
    I'm sure there is a more efficient way than this, but it's quick and dirty...

    Create a webpage from a csv file (or similar) and quickly eye-ball the broken images.
    That's a GREAT idea, one that I used to use.... waaaaaay back when....
    Deborah Carney
    TeamLoxly.com BookGoodies.com ABCsPlus.com

  5. #5
    ABW Veteran Mr. Sal's Avatar
    Join Date
    January 18th, 2005
    Posts
    6,795
    Quote Originally Posted by buyjewelry
    I'm sure there is a more efficient way than this, but it's quick and dirty...

    Create a webpage from a csv file (or similar) and quickly eye-ball the broken images.
    Are you suggesting eye- -balling 10,000 images?




    -------------

    Quote Originally Posted by PetsWarehouse.com
    Is there a way to test a bunch (like 10,000) of image urls to test them for broken links?
    I don't know if this would help you but, here it goes...


    When I have discovered that I might have too many image urls broken links on a big datafeed that I am working on, I just tell the script to either replace that missing image with one of my noimage.gif image, or I might just tell the import script not to load those links from the getgo.

    So when I don't want to have to deal with too many of those image urls broken links I use this code:

    mysql_query ("DELETE from table-name WHERE image Like ''");
    That code will make sure that if the merchant didn't include an image link on the image field, that record would not be included on the display table.

    So I guess that in the same way that, that code can delete the missing links records, I think it can also be codded to just show those missing links records only.

    Yes, I know that there is a big difference between a field for images that has no image urls, and a field for images that may have the wrong image urls on that field, but...

    But, almost nothing is impossible with Php and MySQL, once you learn some tricks.

  6. #6
    Affiliate Manager buyjewelry's Avatar
    Join Date
    January 18th, 2005
    Posts
    400
    Mr. Sal - yep, I said it was quick and dirty

    btw, another thought came to me. if requesting an image that doesn't exist produces the same 404 header (or another error code), perhaps you can crawl the images and update a db for images that produce that error. Don't know if it's possible - but it is a thought.

  7. #7
    Affiliate Manager buyjewelry's Avatar
    Join Date
    January 18th, 2005
    Posts
    400
    Just found this: http://home.snafu.de/tilman/xenulink.html

    The description on the website says it checks for broken links and that the link verification is done on a bunch of different types including images...

  8. #8
    Full Member
    Join Date
    October 22nd, 2006
    Posts
    200
    This checks for valid images and copies them to your server.
    PHP Code:
    <?php
    $imagefiles
    =array(
    'image-100.jpg',
    'file1.jpg',
    'file2.jpg',
    'file.jpg',
    'button_buynow.gif'
    );
    //don't miss out the trailing /
    $path="http://domain.com/images/";
    $newimagefolder="test/";//where to save images
    $csv=fopen("error.csv","w");
    $countgood=0;
    $countbad=0;
    foreach(
    $imagefiles as $key=>$value){
    $data="";
    $fp=@fopen($path.$value,"r");
    if (
    $fp){
    while (!
    feof($fp)) {
      
    $data .= fread($fp8192);
    }
    fclose($fp);
    }
    $img=@imagecreatefromstring($data);
    if (
    $img){
    $countgood=whooppee($value,$img,$countgood,$newimagefolder);
    }
    else
    {
    $countbad=oh_dear($value,$csv,$countbad);
    }
    }
    fclose ($csv);
    //function what to do with good images
    function whooppee($value,$img,$countgood,$newimagefolder){
    //check for gif or jpg 
    $path_parts pathinfo($value);
    $extension=$path_parts['extension'];
    if (
    $extension=="gif"){
    imagegif($img,$newimagefolder.$value);//saves gif
    }
    else
    {
    imagejpeg($img,$newimagefolder.$value);//saves jpeg
    }
    imagedestroy($img);//clears memory
    $countgood++;
    return 
    $countgood;
    }
    //function what do with bad images
    function oh_dear($value,$csv,$countbad){
    fwrite($csv,$value."\r\n");
    $countbad++;
    return 
    $countbad;

    echo 
    "There were ".$countgood." good images <br />";
    echo 
    "There were ".$countbad." missing images <br />";
    ?>
    To create your $imagefiles array in excel
    With all the filenames in column A in B1 enter the formula =+"'"&A1&"',"
    Copy and paste B1 down column B.
    Copy column B and paste it into you php file the delete the , after the last file.

    You must have write pivileges set on your server to write to your newimage folder and also error.csv

    Bob

  9. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Getting Image URLs in place - Please Help!
    By Cheesehead in forum WebMerge (Fourthworld.com)
    Replies: 5
    Last Post: May 31st, 2004, 11:53 AM
  2. Image URLs not working for MacMall
    By Greg Rice in forum Commission Junction - CJ
    Replies: 2
    Last Post: December 1st, 2002, 07:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •