ImageController.php 867 Bytes
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
2
3
4
5
<?php

namespace App\Http\Controllers;

use File;
6
use Illuminate\Http\Request;
Dominik Hebeler's avatar
Dominik Hebeler committed
7
use PiwikTracker;
8
use Response;
Dominik Hebeler's avatar
Dominik Hebeler committed
9
10
11
12
13

class ImageController extends Controller
{
    public function generateImage(Request $request)
    {
Dominik Hebeler's avatar
Dominik Hebeler committed
14
        /*
15
16
17
        #Piwik Code
        PiwikTracker::$URL = 'http://piwik.metager3.de';
        $piwikTracker      = new PiwikTracker($idSite = 1);
Dominik Hebeler's avatar
Dominik Hebeler committed
18

19
20
21
        // Cookies ausschalten
        $piwikTracker->disableCookieSupport();
        $piwikTracker->deleteCookies();
Dominik Hebeler's avatar
Dominik Hebeler committed
22

23
        $site = $request->input('site', '/');
Dominik Hebeler's avatar
Dominik Hebeler committed
24

25
26
        // Sendet Tracker request per http
        $piwikTracker->doTrackPageView($site);
Dominik Hebeler's avatar
Dominik Hebeler committed
27
        */
28
29
30
31
32
        $path     = public_path() . '/img/1px.png';
        $fileType = File::type($path);
        $response = Response::make(File::get($path), 200);
        $response->header('Content-Type', $fileType);
        return $response;
Dominik Hebeler's avatar
Dominik Hebeler committed
33
34
    }
}