This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Creating path and directory for files to live--will live under public dir and then the name we give the next dir | |
//To make image name unique, apply post id to the image's origianl name //--> public/img-upload/ | |
//Need to move newly named image into image dir that was created | |
//defines the image path. this is used when wanting to display image. ex:--> show.blade.php <img src="{{{ $post->img_path }}}" | |
public function addUploadedImage ($image) | |
{ | |
$systemPath = public_path() . '/' . $this->imgDir . '/'; | |
$imageName = $this->id . '-' . $image->getClientOriginalName();//--> 2-image.jpg | |
$image->move($systemPath, $imageName); |