Sign Up

welcome

Already have an account? Sign In

Sign In

welcome

Sign Up
Login with Google

Don't have account, Sign Up Here
Sign In Sign Up

letsrectify

letsrectify
  • Home
  • About Us
  • Contact Us
  • Jobs
Ask a Question
  • Questions & Answers

Questions & Answers

aman
Asked: 24-01-23
Answer

Download S3 images from S3 bucket

  • 0

       $path = 'https://admitoffer.s3.ap-south-1.amazonaws.com/';

       $attachments = Attachments::where('path','LIKE','%'.$path.'%')->pluck('name','path');

       foreach ($attachments as $key => $value) {

           // Image path

           $getUrl = $key.'/'.$value;

           $newPath = str_replace($path,'/', $key);  

           $urlm = $newPath.'/'.$value;

           $imgPath = 's3folder'.$urlm;

           $createfolder = 's3folder'.$newPath;

           if(!File::isDirectory($createfolder)){

               File::makeDirectory($createfolder, 0777, true, true);

           }

           $urls = $getUrl;

            $url = [$getUrl];

 

               foreach($url as $k => $v){

                   $newfname = $imgPath;

                   if(!File::exists($newfname)){

                       if(@fopen($v, 'r') ){

                               

                       $file = fopen($v, 'rb');

                       if ($file) {

                           $newf = fopen($newfname, 'wb');

                           if ($newf) {

                               while (!feof($file)) {

                                   fwrite($newf, fread($file, 1024 * 8), 1024 * 8);

                               }

                           }

                       }

                       if ($file) {

                           fclose($file);

                       }

                       if ($newf) {

                           fclose($newf);

                       }

                       }

                   }

               }

             

           // $contents = file_get_contents($urls);

           // $name = substr($urls, strrpos($urls, '/') + 1);

           // Storage::put($name, $contents);    

           // file_put_contents($createfolder, file_get_contents($getUrl));

 

       }

           dd($id);

Share
  • Facebook

Questions & Answers

Naresh Makwana
Asked: 01-11-22
Answer

Hello sir hosting chahiye

Questions & Answers

ps media
Asked: 22-10-22
Answer

Sir mujhe hosting chahiye

  • 0

Sir muje pococho ki hosting chahiye spot me

Share
  • Facebook
  • ‹
  • 1
  • 2
  • ...
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • ...
  • 292
  • 293
  • ›
Ask A Question
  • Download S3 images from S3 bucket

    • 7 Answers
  • Hello sir hosting chahiye

    • 7 Answers
  • Sir mujhe hosting chahiye

    • 7 Answers
letsrectify

Categories

  • Technology
  • Food
  • Health
  • Sports
  • Science
  • Politics
  • Marketing

Policies

  • Terms & Conditions
  • Privacy Policy

About Us

  • About Us
  • Contact Us
  • Feedback

© 2025 All Rights Reserved by
Letsrectify.com