title: How can we compress image from Image location and move file to Amazon s3 in php with WAF blocks
body: <p>I have an online image location(URL) which I have to upload to Amazon S3.
  If I upload an image which has only 1-2 MB size the WAF not block the image but for the large size image like greater than 5-6 MB than the Amazon WAF blocks the image and gives the <code>403 forbidden error</code> to the uploader, if I upload the same image through any uploader plugin with chunking then no error will be given by WAF so how can I move file from online image location to Amazon S3.</p>
  
  <p>I have tried this below code to save file but it takes too much time for large images to save the file on my server.</p>
  
  <pre><code>$curlSession = curl_init();
  curl_setopt($curlSession, CURLOPT_URL, 'https://sample-videos.com/img/Sample-jpg-image-30mb.jpg');
  curl_setopt($curlSession, CURLOPT_BINARYTRANSFER, true);
  curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, true);
  $jsonData = base64_encode(curl_exec($curlSession));
  $file = base64_to_jpeg($jsonData,'scarletwitch.jpg');
  </code></pre>