Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@symisc
Last active August 12, 2021 01:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save symisc/bd820c4d9a510b38c2aef7f265dd517d to your computer and use it in GitHub Desktop.
Save symisc/bd820c4d9a510b38c2aef7f265dd517d to your computer and use it in GitHub Desktop.
Draw some funny text on top & button of the famous Michael Jordan crying face using the PixLab API - https://pixlab.io/cmd?id=drawtext
<?php
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Draw some funny text on TOP & BOTTOM of the famous Michael Jordan crying face.
# https://pixlab.io/cmd?id=drawtext is the target endpoint for drawing text
# Michael Jordan Crying face
$img = 'https://pixlab.io/images/jdr.jpg';
# Your PixLab API Key
$key = 'PIXLAB_API_KEY'; # Get yours from https://pixlab.io/dashboard
/* Process */
$pix = new Pixlab($key);
if( !$pix->get('drawtext',array(
'img' => $img,
'top' => 'someone bumps the table',
'bottom' => 'right before you win',
'cap' => true, # Capitalize text,
'strokecolor' => 'black'
)) ){
echo $pix->get_error_message()."\n";
die;
}
echo "Pic Link: ".$pix->json->ssl_link."\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment