Skip to content

Instantly share code, notes, and snippets.

@clifgriffin
Last active August 29, 2015 14:04
Show Gist options
  • Save clifgriffin/bcae056f28615c11ba34 to your computer and use it in GitHub Desktop.
Save clifgriffin/bcae056f28615c11ba34 to your computer and use it in GitHub Desktop.
<?php
// autofit_text_to_image() example
// http://cgd.io/2014/auto-fit-text-to-an-image-with-php-and-wordpress
$canvas_image_filename = 'quote_canvas.png';
$dest_filename = 'quote.jpg';
$text = 'I believe in pink. I believe that laughing is the best calorie burner. I believe in kissing, kissing a lot.';
$font_file = 'Cedarville-Cursive.ttf';
autofit_text_to_image($canvas_image_filename, $dest_filename, $text, 60, 500, 400, 40, 400, $font_file);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment