Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2009
    Location
    Bristol, England
    Posts
    830
    Tokens
    0

    Default I need a script which ...

    I love EastEnders and so would like a script which saves the webcam images from the ee site every 2 minutes. I no nothing about PHP and would be over the moon if someone could make this for me. I plan on adding the script as a cron in cPanel after. This is what I want the script to do.

    Save 3 images from 3 different locations every 2 minutes. Locations are ...

    http://www.bbc.co.uk/eastenders/images/live/cam1.jpg
    http://www.bbc.co.uk/eastenders/images/live/cam2.jpg
    http://www.bbc.co.uk/eastenders/images/live/cam3.jpg

    And then if possible save it in the following format from the current scripts directory ...

    /albertsquare/{date e.g. 110809}_{time e.g. 1604}.jpg (This is the location for cam1

    /georgestreet/{date e.g. 110809}_{time e.g. 1604}.jpg (This is the location for cam2)

    /turpinroad/{date e.g. 110809}_{time e.g. 1604}.jpg (This is the location for cam3)

    Thanks again,

    Jack :-)

  2. #2
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    So basically you want it to grab the image

    http://www.bbc.co.uk/eastenders/images/live/cam1.jpg

    and

    http://www.bbc.co.uk/eastenders/images/live/cam2.jpg

    and

    http://www.bbc.co.uk/eastenders/images/live/cam3.jpg

    And then save it as a timecode basically under a folder
    Chippiewill.


  3. #3
    Join Date
    Feb 2009
    Location
    Bristol, England
    Posts
    830
    Tokens
    0

    Default

    Quote Originally Posted by 00chips View Post
    So basically you want it to grab the image

    http://www.bbc.co.uk/eastenders/images/live/cam1.jpg

    and

    http://www.bbc.co.uk/eastenders/images/live/cam2.jpg

    and

    http://www.bbc.co.uk/eastenders/images/live/cam3.jpg

    And then save it as a timecode basically under a folder
    Yes please! Can this be done?

  4. #4
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    Yeh, I'm not doing it for free but it'd just be createjpegfrom or w/e in PHP GD. Or it's probably possible to just simple copy it.

    I've never copied cross URL so I don't know if you can use copy();

  5. #5
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    Just download it to a location and then copy it (Timecoded) to the folder

    http://php.about.com/od/advancedphp/..._read_file.htm

    For info on downloading the file
    Chippiewill.


  6. #6
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Setup a cron job for every 2 minutes, create the three folders.. and make sure you chmod them.

    PHP Code:
    <?php
    // 
    //  save_image.php
    //  Eastenders - Image Save
    //  
    //  Created by Caleb Mingle on 2009-08-12.
    //  Copyright 2009 MacDowell Diesel Performance. All rights reserved.
    // 

    /* Grabs the images */
    $image = array();
    $image[1] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam1.jpg");
    $image[2] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam2.jpg");
    $image[3] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam3.jpg");

    /* Sets up the folder locations */
    $location = array();
    $location[1] = 'albertsquare';
    $location[2] = 'georgestreet';
    $location[3] = 'turpinroad';

    $filename date('dmy_gi') . '.jpg'// file name for the images.

    $counter 1// counter for the location.


    foreach($image as $key => $value) {    
        
    $image imagecreatefromstring($value); // creates image from data.
        
    imagejpeg($image"{$location[$counter]}/{$filename}"); // saves image in location.
        
        
    $counter++; // increments counter.
    }

  7. #7
    Join Date
    Feb 2009
    Location
    Bristol, England
    Posts
    830
    Tokens
    0

    Default

    Quote Originally Posted by Dentafrice View Post
    Setup a cron job for every 2 minutes, create the three folders.. and make sure you chmod them.

    PHP Code:
    <?php
    // 
    //  save_image.php
    //  Eastenders - Image Save
    //  
    //  Created by Caleb Mingle on 2009-08-12.
    //  Copyright 2009 MacDowell Diesel Performance. All rights reserved.
    // 
     
    /* Grabs the images */
    $image = array();
    $image[1] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam1.jpg");
    $image[2] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam2.jpg");
    $image[3] = file_get_contents("http://www.bbc.co.uk/eastenders/images/live/cam3.jpg");
     
    /* Sets up the folder locations */
    $location = array();
    $location[1] = 'albertsquare';
    $location[2] = 'georgestreet';
    $location[3] = 'turpinroad';
     
    $filename date('dmy_gi') . '.jpg'// file name for the images.
     
    $counter 1// counter for the location.
     
     
    foreach($image as $key => $value) {    
        
    $image imagecreatefromstring($value); // creates image from data.
        
    imagejpeg($image"{$location[$counter]}/{$filename}"); // saves image in location.
     
        
    $counter++; // increments counter.
    }
    Thanks, I owe you +rep, need to spread more around first.

  8. #8
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    Quote Originally Posted by jack-bristol View Post
    Thanks, I owe you +rep, need to spread more around first.
    I repped him for you

Posting Permissions

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