Source for file test.php
Documentation is available at test.php
#ini_set('include_path', '.');
* Usage: test.php?driver=XX
// as we're testing we want high error reporting
// Where we'll put resulting image and HTML files...
define('TEST_DIR', dirname (__FILE__ ) . DIRECTORY_SEPARATOR );
define('TEST_IMAGE_DIR', TEST_DIR . 'images' . DIRECTORY_SEPARATOR );
define('TEST_OUTPUT_DIR', TEST_DIR . 'tmp' . DIRECTORY_SEPARATOR );
define('FONTS', '/usr/share/fonts/');
define('FONTS_TTF', FONTS . DIRECTORY_SEPARATOR . 'corefonts' . DIRECTORY_SEPARATOR );
#$lib_path = array('IM' =>)
$driver = $_GET['driver'];
if (!defined('IMAGE_TRANSFORM_LIB_PATH')) {
define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/');
if ($driver == 'IM' || $driver == 'NetPBM') {
// Assume binaries are in your path
#define('IMAGE_TRANSFORM_LIB_PATH', '');
require_once 'Image/Transform.php';
if (PEAR ::isError ($im)) {
$cmd = isset ($_GET['cmd']) ? $_GET['cmd'] : '';
$angle = isset ($_GET['angle']) ? intval($_GET['angle']) : 0;
$width = isset ($_GET['width']) ? intval($_GET['width']) : $im->getImageWidth ();
$height = isset ($_GET['height']) ? intval($_GET['height']) : $im->getImageHeight ();
$text = isset ($_GET['text']) ? $_GET['text'] : 'Sample Text';
* Now start. Switch cmd to find which test to run
$im->addText (array ('text' => $text, 'font' => FONTS_TTF . '/arial.ttf'));
$im->resize ($width/2 , $height/2 );
case 'scaleByPercentage':
$im->scaleByPercentage (50 );
#$im->save($image_file . '-' . $driver);
* Now load the image, and:
* a) add text and then resize
* a) resize and then add text
* Check the font size is different
Documentation generated on Mon, 11 Mar 2019 15:48:01 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|