Skip to content

Commit

Permalink
Examples updated
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluisq committed Jun 22, 2016
1 parent 0a3e42d commit b5761a6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
6 changes: 6 additions & 0 deletions examples/_config.php
@@ -0,0 +1,6 @@
<?php

define('BASE_PATH', dirname(__FILE__));
define('ROOT_PATH', dirname(BASE_PATH));
define('TMP_PATH', ROOT_PATH . '/tmp');
define('GIMAGE_PATH', ROOT_PATH . '/src/gimage');
5 changes: 1 addition & 4 deletions examples/card.php
Expand Up @@ -4,10 +4,7 @@
* Creating a Presentation Card
*/

define('BASE_PATH', dirname(__FILE__));
define('ROOT_PATH', dirname(BASE_PATH));
define('TMP_PATH', ROOT_PATH . '/tmp');
define('GIMAGE_PATH', ROOT_PATH . '/src/gimage');
require __DIR__ . '/_config.php';

require GIMAGE_PATH . '/gutils.php';
require GIMAGE_PATH . '/gimage.php';
Expand Down
17 changes: 17 additions & 0 deletions examples/crop.php
@@ -0,0 +1,17 @@
<?php

/**
* Crop an image
*/

require __DIR__ . '/_config.php';

require GIMAGE_PATH . '/gutils.php';
require GIMAGE_PATH . '/gimage.php';

$image = new GImage();
// Load an image (300px x 300px)
$image->load('http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=300.jpg');
// Resize and crop in the middle (100px x 60px)
$image->centerCrop(100, 60);
$image->save(TMP_PATH . '/crop.jpg');
5 changes: 1 addition & 4 deletions examples/rotate.php
Expand Up @@ -4,10 +4,7 @@
* Rotate an image
*/

define('BASE_PATH', dirname(__FILE__));
define('ROOT_PATH', dirname(BASE_PATH));
define('TMP_PATH', ROOT_PATH . '/tmp');
define('GIMAGE_PATH', ROOT_PATH . '/src/gimage');
require __DIR__ . '/_config.php';

require GIMAGE_PATH . '/gutils.php';
require GIMAGE_PATH . '/gimage.php';
Expand Down
7 changes: 2 additions & 5 deletions examples/text.php
Expand Up @@ -4,10 +4,7 @@
* Creating Canvas with Text
*/

define('BASE_PATH', dirname(__FILE__));
define('ROOT_PATH', dirname(BASE_PATH));
define('TMP_PATH', ROOT_PATH . '/tmp');
define('GIMAGE_PATH', ROOT_PATH . '/src/gimage');
require __DIR__ . '/_config.php';

require GIMAGE_PATH . '/gutils.php';
require GIMAGE_PATH . '/gimage.php';
Expand All @@ -19,7 +16,7 @@
$figure->setBackgroundColor(47, 42, 39);
$figure->create();

$text = new GText('Imprimir una imagen PNG al navegador o a un archivo');
$text = new GText('Output PNG file to browser o save into file.');
$text->setWidth(400);
$text->setHeight(250);
$text->setLineHeight(1.2);
Expand Down

0 comments on commit b5761a6

Please sign in to comment.