App\Http\Controllers\ImageController::image PHP Method

image() public method

public image ( )
    public function image()
    {
        $key = strip_tags(\Route::input('key'));
        $key = str_replace('.png', '', $key);
        if (empty($key)) {
            return redirect('/');
        } else {
            $result = \DB::table('post')->where('post_key', $key)->first();
            if ($result->post_type == 3) {
                $text = $result->post_message;
                $text = $this->handleText($text);
                $image = $this->warpTextImage($text);
                ob_start();
                imagepng($image, null, 9, null);
                $image = ob_get_contents();
                ob_end_clean();
                @imagedestroy($image);
                $response = \Response::make($image);
                $response->header('Content-Type', 'image/png');
                return $response;
            } else {
                return redirect('/');
            }
        }
    }