Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:29+00:00 2026-05-26T15:15:29+00:00

Is there a way to grab an image using URL and save it directly

  • 0

Is there a way to grab an image using URL and save it directly to Amazon?

Can it be done using PHP?

My other option was to save file locally and send it using the S3 PHP class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:15:29+00:00Added an answer on May 26, 2026 at 3:15 pm

    When you “grab the image”, you are going to have to at a minimum write it to a temporary file locally. That’s because whether you use fopen() or curl to access the file you are going to need some way to write the stream to Amazon. I’m not sure of a way to program a stream that essentially connects the remote file directly to S3. In fact, it’s theoretically impossible as S3 cannot execute scripts and the image cant run a script.

    You could load the image through some form of stream buffer if you are looking to minimize the amount of information stored in memory, but writing it to a temporary file should be the easiest thing. If you run out of space because you have so many users in the system you either upgrade to a large server or add another server under a load balancer. Personally, I use Amazon’s S3 PHP class on my system and move it from a temp file locally directly to S3 using a script like this one:

    function upload_image( $image_data )
    {
        //
        // Write the image to S3
        //  
        $s3 = new AmazonS3();
        $bucket = ACTIVITY_S3_BUCKET;
        $image_id = uniqid('myscript');
        $path = ACTIVITY_S3_FOLDER.'/'.$image_id;
        $response = $s3->create_object($bucket, $path, array(
            'body'  => $image_data,
            'acl'   =>  AmazonS3::ACL_PUBLIC
        ));
        $image_url = 'https://s3.amazonaws.com/'.ACTIVITY_S3_BUCKET.'/'.$path;
        return $image_id;
    }
    

    Clearly this isn’t a robust script but figured I’d just share the path that I’ve gone down myself. I should add, as it seems your primary concern in this case would be processing power, check out this interesting post on resizing billions of images in the cloud. http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/

    Update
    According to this answer How best to resize images off-server “PHP/GD lets you send jpeg directly in http response.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to grab the URL's hash value (e.g. the 35 in
With a windows MSI file, is there a way to grab all the possible
Is there any way to check whether a file is locked without using a
Is there an easy way to grab a users twitter image with a simple
Using Paperclip, I want to grab an image from a URL like this: require
is there way thats i can preselect an item when the page loads or
Is there way in next piece of code to only get the first record?
is there way how to get name ov event from Lambda expression like with
Is there way to better identify design pattern in source codes, esp. if you
Is there way to mute an audio stream or at least control the volume?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.