getPhoto laravel

public function getPhoto(Request $request)
{    $photo = new \App\Photo();
    if ($file = $request->image) {        list($type, $imageData) = explode(';', $request->image);
        list(, $extension) = explode('/', $type);
        list(, $imageData) = explode(',', $imageData);
        $fileName = uniqid() . '.' . $extension;
        $source = fopen($request->image, 'r');
        $destination = fopen('images/' . $fileName, 'w');
        stream_copy_to_stream($source, $destination);
        fclose($source);
        fclose($destination);
        $photo = \App\Photo::create(['name' => $fileName]);
        return $photo;
    }    return $photo;
}



No comments:

The 6 New Rules of Communicating

The era of teleprompters and talking points has come to an end ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *