Skip to content

Instantly share code, notes, and snippets.

@OliPassey
Created January 11, 2020 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OliPassey/e364e966b9476089e748344a5d2a5d37 to your computer and use it in GitHub Desktop.
Save OliPassey/e364e966b9476089e748344a5d2a5d37 to your computer and use it in GitHub Desktop.
<?php
$my_img = imagecreatefrompng ( "x_feature_template.png" );
$background = imagecolorallocate( $my_img, 149, 152, 192 );
$text_colour = imagecolorallocate( $my_img, 18, 12, 45 );
$button_text_colour = imagecolorallocate( $my_img, 197, 184, 114 );
$font_bold = 'palatino.ttf';
$font_medium = 'palatino.ttf';
$font_reg = 'palatino-light.ttf';
$font_light_italic = 'palatino-light-italic.ttf';
$headline_text = 'Christmas and New Year ';
$date_time = 'Opening Hours';
$venue = 'Saturday 21 9am-5.30pm Friday 27 10am-5.30pm';
$full_text1 = 'Sunday 22 10am-4pm Saturday 28 9am-5.30pm';
$full_text2 = 'Monday 23 9am-5.30pm Sunday 29 Closed';
$full_text3 = 'Christmas Eve 9am-4.30pm Monday 30 9am-5.30pm';
$full_text4 = 'Christmas Day Closed Tuesday 31 9am-4.30pm';
$full_text5 = 'Boxing Day Closed Wednesday 1 Closed';
$feature_image = imagecreatefromjpeg('');
imagettftext($my_img, 28, 0, 245, 50, $text_colour, $font_bold, $headline_text);
imagettftext($my_img, 28, 0, 245, 85, $text_colour, $font_bold, $date_time);
imagettftext($my_img, 14, 0, 255, 130, $text_colour, $font_reg, $venue);
imagettftext($my_img, 14, 0, 255, 155, $text_colour, $font_reg, $full_text1);
imagettftext($my_img, 14, 0, 255, 180, $text_colour, $font_reg, $full_text2);
imagettftext($my_img, 14, 0, 255, 205, $text_colour, $font_reg, $full_text3);
imagettftext($my_img, 14, 0, 255, 230, $text_colour, $font_reg, $full_text4);
imagettftext($my_img, 14, 0, 255, 255, $text_colour, $font_reg, $full_text5);
imagecopy($my_img, $feature_image, 14, 14, 0, 0, 200, 273);
header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment