I love the reply. "You don't know the codebase, IT R HARD!"
Really? It is now 21:28 local. I never worked with PHP GD. I just typed php GD turorial
in Google and I'm leaving this reply box open.
It is now 21:49 local. Didn't even use the tutorial, just went to the docs. Had to use Google once, and that's only because I was apparently blind.
I also created a new cloud9 workspace in the time allotted so I can link this: https://letteravatars-onyx47.c9.io/
It will only generate a white T
on a black background but really, does anyone doubt in how easy it is to change colours?
This is the entire code:
<?php
$image = imagecreatetruecolor(128, 128);
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imagefilledrectangle($image, 0, 0, 128, 128, $black);
$font = './DejaVuSans-Bold.ttf';
$text = 'T';
$box = imagettfbbox(64, 0, $font, 'T');
imagettftext($image, 64, 0, (128 - $box[4]) / 2, 128 - ((128 - $box[1]) / 4), $white, $font, $text);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>
Modifications to make it save the image? Remove the header
line and add the filename as the second parameter to imagepng
function.
This is fucking PHP. Personal fucking Hell Pit! 20 lines! With spacing!
I don't give a toss about your "complicated architecture". This is a standalone fucking file. Just call the fucking thing! No routing Ruby on Ember Rails with a Sidequik of bullshit and garnished with Redis. IT'S A FUCKING SCRIPT, WE'VE BEEN DOING THIS SINCE THE DAYS OF CGI!