<?php

require "../src/magic.class.php";
$test = new Priler\Text2Image\Magic("\nLorem Ipsum is simply dummy text of the printing and typesetting industry.\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.\n");
// force mode into smart
$test->set_mode('smart');
// load custom font
// smart-mode work's exactly with .TTF, but other font's may also be supported, see PHP GD docs for more info
$test->add_font('MyFont', './assets/foughtknight.ttf');
$test->font = $test->get_font('MyFont');
// also, smart mode supports text-size property and angle property (last one shown in 5th example)
$test->text_size = 20;
// this settings is same as on 3rd example
$test->width = 720;
// custom width
$test->background_color = '#263238';
// custom background color
$test->text_color = '#eee';
// custom text color
$test->line_height = 30;
// custom line height
$test->padding = 50;
// custom padding
$test->output();
<?php

require "../src/magic.class.php";
$test = new Priler\Text2Image\Magic("\nLorem Ipsum is simply dummy text of the printing and typesetting industry.\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.\n");
// load custom font
// simple-mode work's with only GDF font's
$test->add_font('MyFont', './assets/foughtknight.gdf', 1);
// 1 at end forces mode into simple
$test->font = $test->get_font('MyFont');
$test->width = 720;
// custom width
$test->background_color = '#263238';
// custom background color
$test->text_color = '#eee';
// custom text color
$test->line_height = 30;
// custom line height
$test->padding = 50;
// custom padding
$test->output();
Пример #3
0
<?php

require "../src/magic.class.php";
$test = new Priler\Text2Image\Magic('Hello world!
This cool image was saved to file with JPEG quality equal to 75.

Other formats, like GIF, PNG and WBMP are supported too.
In JPG quality can be between 0 (worst) and 100 (highest quality), of course it makes sense on output file size.
In PNG quality means the compression rate (between 0 and 9).

Also, you might wanna check if you\'r PHP build support\'s required image type or not.
You can do this easily using method called is_imagetype_supported($type) on any instance of Priler\\Text2Image\\Magic.

Thanks.');
$test->save('6_Save_Into_File_OUTPUT.jpg', 'jpg', 75);
echo 'Saved!';
Пример #4
0
<?php

require "../src/magic.class.php";
$test = new Priler\Text2Image\Magic("\nLorem Ipsum is simply dummy text of the printing and typesetting industry.\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.\nIt has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.\n");
$test->width = 320;
// custom width
$test->background_color = '#FF5370';
// custom background color
$test->text_color = '#eee';
// custom text color
$test->line_height = 30;
// custom line height
$test->padding = 50;
// custom padding
$test->output();
Пример #5
0
<?php

require "../src/magic.class.php";
$test = new Priler\Text2Image\Magic(file_get_contents(__FILE__));
$test->text_color = '#C792EA';
// you can use hex
$test->text_color = array(199, 146, 234);
// or array of rgb values to set color you want
$test->output('jpg', 75);