<?php
$dir = __DIR__ . '/placeholders';
if ( ! is_dir( $dir ) ) {
	mkdir( $dir, 0755, true );
}
$items = array(
	array( 'book', '#0f766e' ),
	array( 'science', '#134e4a' ),
	array( 'math', '#0d9488' ),
	array( 'language', '#f59e0b' ),
	array( 'study', '#0f766e' ),
);
foreach ( $items as $item ) {
	[ $name, $hex ] = $item;
	$im = imagecreatetruecolor( 1200, 675 );
	$r  = hexdec( substr( $hex, 1, 2 ) );
	$g  = hexdec( substr( $hex, 3, 2 ) );
	$b  = hexdec( substr( $hex, 5, 2 ) );
	$bg = imagecolorallocate( $im, $r, $g, $b );
	$fg = imagecolorallocate( $im, 255, 255, 255 );
	$lt = imagecolorallocate( $im, 255, 255, 255 );
	imagefilledrectangle( $im, 0, 0, 1200, 675, $bg );
	imagefilledrectangle( $im, 80, 120, 520, 520, $lt );
	imagefilledrectangle( $im, 140, 180, 460, 220, $bg );
	imagefilledrectangle( $im, 140, 260, 400, 290, $bg );
	imagefilledrectangle( $im, 140, 320, 360, 350, $bg );
	imagestring( $im, 5, 560, 280, 'Kutby Edu', $fg );
	imagepng( $im, $dir . '/' . $name . '.png' );
	imagedestroy( $im );
}
echo "generated\n";
