Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Generate line numbers to Sublime VintageLines plugin
<?php
// Set the content-type
header('Content-Type: image/png');
// Replace with your own font and font-size
$font = 'UbuntuMono-R.ttf';
$fontsize = 11;
// Create the numbers directory if it doesn't exist
if(!is_dir(dirname(__FILE__) . '/numbers/')) {
mkdir(dirname(__FILE__) . '/numbers/', 777);
}
for ($i = 0; $i <= 80; $i++) {
$text = ($i <= 9)? ' ' . $i : $i;
$im = imagecreatetruecolor(16, 16);
imagealphablending($im, true);
// Create some colors
$white = imagecolorallocatealpha($im, 255, 255, 255, 0);
$transp = imagecolorallocatealpha($im, 0, 0, 0, 127);
// $grey = imagecolorallocate($im, 128, 128, 128);
// $black = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, $transp);
imagesavealpha($im, true);
imagettftext($im, $fontsize, 0, 1, 11, $white, $font, $text);
$imagepath = 'numbers/' . $i . '.png';
imagepng($im, $imagepath);
readfile($imagepath);
imagedestroy($im);
}
?>
@weslly
Owner

Example (using ubuntu mono):
Screenshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.