0

i want to add some text on image ....i have already a image and add text on that ....so now i'm using the image intervention package.It is working fine in my local machine but on server it showing some image source nor readable error....and i saw when i upload this code ...the image text is working fine with the public folder but i want to add the images on public_html/images not the public/images because the main folder of images is located in public_html so may be i have to change the default public path public to public_html.

Image make function

   {
 $img = Image::make(public_path('/home/u944619310/domains/shubhampackers.com/public_html/images/Capture.JPG'));  
$img->text('This is a example ', 300, 300);  
$img->save(public_path('/home/u944619310/domains/shubhampackers.com/public_html/images/vivk.jpg'));  
return response()->json(['success'=>true]);
}  



error showing 

message: "Image source not readable", exception: "Intervention\Image\Exception\NotReadableException",…}
exception: "Intervention\Image\Exception\NotReadableException"
file: "/home/u944619310/domains/shubhampackers.com/public_html/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php"
line: 346
message: "Image source not readable"


even i tried given method from stack overflow to do some changes in App/Providers/AppServiceProvider.php

public function register()
   {
       //
      $this->app->bind('path.public', function() {
       return base_path().'/public_html';
   });
   }
Dev vivek
  • 45
  • 1
  • 8
  • [Answer is here](https://stackoverflow.com/questions/31758901/laravel-5-change-public-path) Just put The `App->bind to public_html/index.php` – Morteza Negahi Aug 25 '19 at 04:56
  • where to put this – Dev vivek Aug 25 '19 at 04:59
  • look at laravel directories. in public directory you have index.php, put this after $kernel – Morteza Negahi Aug 25 '19 at 05:01
  • if i'm not wrong then when we are deploying our project all the files from public we moved to public_html...so now the index file are is on public_html right?? – Dev vivek Aug 25 '19 at 05:03
  • @vikas i have two folders one is in public_html and other is from local machine that is public folder .....when we are deplyoing our project to server we have to move all the files from public to public_html ... so i moved the images folder from public to public_html ...now acc to images all the files will be save on public_html/images not on the public/images .....and public/images working fine as i said when i upload that code first time .... – Dev vivek Aug 25 '19 at 05:07
  • @vikas yes the path is correct – Dev vivek Aug 25 '19 at 06:40
  • @MortezaNegahi yeah your solution is worked...for me thanks a lot – Dev vivek Aug 25 '19 at 06:46

0 Answers0