Created
December 28, 2019 03:24
-
-
Save iggyvolz/971c76c8b6a893b9328fe678f695a362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/vendor/autoload.php'; | |
use GDText\Box; | |
use GDText\Color; | |
define("DEBUG", false); | |
if(DEBUG) { | |
header("Content-Type: text/plain"); | |
} else { | |
header("Content-Type: image/png"); | |
} | |
$source=imagecreatefromjpeg(__DIR__."/12igo6.jpg"); | |
$img=imagecreatetruecolor(imagesx($source), 5*imagesy($source)); | |
$white=imagecolorallocate($img, 255, 255, 255); | |
$black=imagecolorallocate($img, 0, 0, 0); | |
imagefill($img, 0, 0, $white); | |
imagecopy($img, $source, 0, 0, 0, 0, imagesx($source)/2, imagesy($source)); | |
imagecopy($img, $source, 0, imagesy($source), imagesx($source)/2, 0, imagesx($source)/2, imagesy($source)); | |
imagecopy($img, $source, 0, 2*imagesy($source), 0, 0, imagesx($source)/2, imagesy($source)); | |
imagecopy($img, $source, 0, 3*imagesy($source), imagesx($source)/2, 0, imagesx($source)/2, imagesy($source)); | |
imagecopy($img, $source, 0, 4*imagesy($source), 0, 0, imagesx($source)/2, imagesy($source)); | |
function text(string $text, int $size, int $y) | |
{ | |
global $source, $img; | |
$x=imagesx($source)/2; | |
$y*=imagesy($source); | |
$width=imagesx($source)/2; | |
$height=imagesy($source); | |
$box = new Box($img); | |
$box->setFontFace("/usr/share/fonts/liberation/LiberationMono-Regular.ttf"); | |
$box->setFontColor(new Color(0, 0, 0)); | |
$box->setFontSize($size); | |
$box->setBox($x, $y, $width, $height); | |
$box->setTextAlign("center", "center"); | |
$box->draw($text); | |
} | |
text("Seeing your friend posting something from Reddit", 24, 0); | |
text("Realizing that they browse Reddit and might recognize you", 24, 1); | |
text("Remembering that you never post on Reddit so it doesn't matter", 24, 2); | |
text("Remembering that you sometimes post about being trans so you might be outed", 24, 3); | |
text("Remembering that you're out to that person and they only know you as trans", 24, 4); | |
if(!DEBUG) { | |
imagepng($img); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment