SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2002
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy how to copy a remote image to my server???

    I am creating a script that takes an image from one server, makes it smaller and saves it on another server but I am stuck on how to transfer an image...

    I tried this:

    PHP Code:
    $url_logo 'http://www.serverA.com/image.jpg';
    $url_logo_local 'smaller_image.jpg';
    $fp fopen($url_logo"r");
    while(!
    feof($fp)) {
     
    $contents .= fread($fp4096);
    }
    fclose($fp);
    $fp fopen($url_logo_local"w+");
    fwrite($fp$contents);
    fclose($fp); 
    which works but takes FOREVER (setting the exectution limit to 120 seconds still is not enough, even with small files) so I am hoping that somebody can suggest a better way!

    Thanks a lot if you can help!

  2. #2
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could try file_get_contents(), it might be faster.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

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