0

I was reading Laravel documentation, and came across the following example which I didn't quite understand:

use Illuminate\Support\Facades\Storage;

Storage::put('file.jpg', $contents);

Storage::put('file.jpg', $resource);

I understand that the arg1 is the path of file or directory and the arg2 is the content to be written into file or file to be saved into directory. However, I don't quite understand the PHP resource here. Is there anything I could use the PHP recourse on a jpg file? Or the document actually means that I could save a PHP resource into the directory, but it just misplaced a jpg example instead of directory?

Anyone could help will be so much appreciated.

Ray
  • 333
  • 4
  • 11
  • A resource can be a reference to an opened jpeg file. Maybe reading about resources would help you understand. https://www.php.net/manual/en/language.types.resource.php | check this as well: https://stackoverflow.com/questions/8814364/php-how-to-write-image-resource-to-file – user3532758 Jan 08 '21 at 08:34
  • @user3532758 Hey! Thanks for your reply. I read the information you provided. Could you also make some examples in this case? – Ray Jan 08 '21 at 11:26

0 Answers0