function doImage($source, $width, $height, $timestamp = true, $name)
{
    $origImage = getImage($source, $width, $height);
    if (is_null($origImage)) {
        die("Rendering Error");
    }
    $image = resize($origImage, $width, $height);
    $thumb = resize($origImage, 100, 75);
    if ($timestamp) {
        $image = addTimeStamp($image);
    }
    $compression = 75;
    $filepath = "screenshots/";
    $filename = $filepath . $name . "_" . time() . ".jpg";
    $filename_thumb = $filepath . $name . "_" . time() . "_thumb.jpg";
    //main image
    imagejpeg($image, $filename, $compression);
    chmod($filename, 0600);
    imagedestroy($image);
    //thumb image
    imagejpeg($thumb, $filename_thumb, $compression);
    chmod($filename_thumb, 0600);
    imagedestroy($thumb);
    echo "OK";
}
function doImage($source, $width, $height, $timestamp = true)
{
    $image = getImage($source, $width, $height);
    if (is_null($image)) {
        die("Rendering Error");
    }
    //no cache
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header('Content-Type: image/jpeg');
    $image = resize($image, $width, $height);
    if ($timestamp) {
        $image = addTimeStamp($image);
    }
    imagejpeg($image);
    imagedestroy($image);
}
<?php

require_once "../php/connectdb.php";
require_once "../model/statIdModel.php";
addTimeStamp($dbh, $_GET);