imagecopyresized($img, $dotLayerImg, 840, 550, 0, 0, 200, 100, 200, 100); //header text $box = new Box($img); $box->setFontFace(__DIR__ . '/fonts/Amatic-Bold.ttf'); $box->setFontColor($colorHeader); $box->setFontSize(80); $box->setLineHeight(1); $box->setBox(580, 70, 480, 50); $box->setTextAlign('center', 'center'); $box->draw($headerText); //route box $box = new Box($img); $box->setFontFace(__DIR__ . '/fonts/Lato-Medium.ttf'); $box->setFontColor($colorRoute); $box->setFontSize(21); $box->setBox(600, 140, 460, 100); $box->setTextAlign('center', 'center'); $box->draw($routeText); //description box $box = new Box($img); $box->setFontFace(__DIR__ . '/fonts/Lato-Light.ttf'); $box->setFontColor($colorText); $box->setFontSize(19); $box->setLineHeight(1.4); $box->setBox(630, 260, 440, 300); $box->setTextAlign('center', 'top'); $box->draw($descriptionText); //send photo to user header('Content-type: image/jpeg'); header('Content-Disposition: inline; filename="day-' . $_POST['day'] . '.jpg"'); imagejpeg($img, null, 100);