00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 include_once( "lib/eztemplate/classes/eztemplate.php" );
00044 include_once( "lib/ezimage/classes/ezimageobject.php" );
00045 include_once( "lib/ezimage/classes/ezimagelayer.php" );
00046 include_once( "lib/ezimage/classes/ezimagetextlayer.php" );
00047 include_once( 'lib/ezimage/classes/ezimagefont.php' );
00048 include_once( "lib/ezutils/classes/ezini.php" );
00049
00050 class eZTemplateImageOperator
00051 {
00052
00053
00054
00055 function eZTemplateImageOperator( $texttoimageName = "texttoimage",
00056 $imageName = "image",
00057 $imagefileName = "imagefile" )
00058 {
00059 $this->Operators = array( $texttoimageName,
00060 $imageName,
00061 $imagefileName );
00062
00063 include_once( "lib/ezutils/classes/ezsys.php" );
00064 $ini =& eZINI::instance( 'texttoimage.ini' );
00065 $fontDirs = $ini->variable( "PathSettings", "FontDir" );
00066 $this->FontDir = array();
00067 foreach ( $fontDirs as $fontDir )
00068 {
00069 $this->FontDir[] = $fontDir;
00070 }
00071 $this->CacheDir = $ini->variable( "PathSettings", "CacheDir" );
00072 $this->HTMLDir = eZSys::wwwDir() . $ini->variable( "PathSettings", "HtmlDir" );
00073
00074 $this->DefaultClass = 'default';
00075 $this->Family = "arial";
00076 $this->Colors = array( "bgcolor" => array( 255, 255, 255 ),
00077 "textcolor" => array( 0, 0, 0 ) );
00078 $this->PointSize = 12;
00079 $this->Angle = 0;
00080 $this->XAdjust = 0;
00081 $this->YAdjust = 0;
00082 $this->WAdjust = 0;
00083 $this->HAdjust = 0;
00084 $this->UseCache = true;
00085 if ( $ini->variable( "ImageSettings", "UseCache" ) == "disabled" )
00086 $this->UseCache = false;
00087
00088 $functions = array( "ImageTTFBBox",
00089 "ImageCreate",
00090 "ImageColorAllocate",
00091 "ImageColorAllocate",
00092 "ImageTTFText",
00093 "ImagePNG",
00094 "ImageJPEG",
00095 "ImageDestroy" );
00096 $this->MissingGDFunctions = array();
00097 foreach ( $functions as $function )
00098 {
00099 if ( !function_exists( $function ) )
00100 $this->MissingGDFunctions[] = $function;
00101 }
00102 $this->ImageGDSupported = count( $this->MissingGDFunctions ) == 0;
00103 }
00104
00105 function operatorTemplateHints()
00106 {
00107 return array( 'texttoimage' => array( 'input' => true,
00108 'output' => true,
00109 'output-type' => array( 'objectproxy', 'keep' ),
00110 'parameters' => true ),
00111 'image' => array( 'input' => false,
00112 'output' => true,
00113 'output-type' => array( 'objectproxy', 'keep' ),
00114 'parameters' => true ),
00115 'imagefile' => array( 'input' => false,
00116 'output' => true,
00117 'output-type' => 'objectproxy',
00118 'parameters' => true ) );
00119 }
00120
00121
00122
00123
00124
00125 function modify( &$tpl, &$operatorName, &$operatorParameters, &$rootNamespace, &$currentNamespace, &$inputValue, &$namedParameters,
00126 $placement )
00127 {
00128 if ( !$this->ImageGDSupported )
00129 {
00130 eZDebug::writeError( "$operatorName cannot be used since the following ImageGD functions are missing: " . implode( ', ', $this->MissingGDFunctions ) );
00131 return;
00132 }
00133
00134 if ( $operatorName == 'texttoimage' )
00135 {
00136 $class = $namedParameters['class'];
00137
00138 $family = $this->Family;
00139 $size = $this->PointSize;
00140 $angle = $this->Angle;
00141 $xadj = $this->XAdjust;
00142 $yadj = $this->YAdjust;
00143 $wadj = $this->WAdjust;
00144 $hadj = $this->HAdjust;
00145 $usecache = $this->UseCache;
00146 $bgcol = $this->color( "bgcolor" );
00147 $textcol = $this->color( "textcolor" );
00148
00149 $ini =& eZINI::instance( 'texttoimage.ini' );
00150 $family = $ini->variable( 'DefaultSettings', 'Family' );
00151 $size = $ini->variable( 'DefaultSettings', 'PointSize' );
00152 $angle = $ini->variable( 'DefaultSettings', 'Angle' );
00153 $xadj = $ini->variable( 'DefaultSettings', 'XAdjustment' );
00154 $yadj = $ini->variable( 'DefaultSettings', 'YAdjustment' );
00155 $wadj = $ini->variable( 'DefaultSettings', 'WidthAdjustment' );
00156 $hadj = $ini->variable( 'DefaultSettings', 'HeightAdjustment' );
00157 $bgcol = $this->decodeColor( $ini->variable( 'DefaultSettings', 'BackgroundColor' ) );
00158 $textcol = $this->decodeColor( $ini->variable( 'DefaultSettings', 'TextColor' ) );
00159
00160 $absoluteWidth = false;
00161 $absoluteHeight = false;
00162
00163 if ( $ini->hasVariable( $class, 'Family' ) )
00164 $family = $ini->variable( $class, 'Family' );
00165 if ( $ini->hasVariable( $class, 'PointSize' ) )
00166 $size = $ini->variable( $class, 'PointSize' );
00167 if ( $ini->hasVariable( $class, 'Angle' ) )
00168 $angle = $ini->variable( $class, 'Angle' );
00169 if ( $ini->hasVariable( $class, 'XAdjustment' ) )
00170 $xadj = $ini->variable( $class, 'XAdjustment' );
00171 if ( $ini->hasVariable( $class, 'YAdjustment' ) )
00172 $yadj = $ini->variable( $class, 'YAdjustment' );
00173 if ( $ini->hasVariable( $class, 'WidthAdjustment' ) )
00174 $wadj = $ini->variable( $class, 'WidthAdjustment' );
00175 if ( $ini->hasVariable( $class, 'HeightAdjustment' ) )
00176 $hadj = $ini->variable( $class, 'HeightAdjustment' );
00177 if ( $ini->hasVariable( $class, 'BackgroundColor' ) )
00178 $bgcol = $this->decodeColor( $ini->variable( $class, 'BackgroundColor' ) );
00179 if ( $ini->hasVariable( $class, 'TextColor' ) )
00180 $textcol = $this->decodeColor( $ini->variable( $class, 'TextColor' ) );
00181 if ( $ini->hasVariable( $class, 'AbsoluteWidth' ) )
00182 $absoluteWidth = $ini->variable( $class, 'AbsoluteWidth' );
00183 if ( $ini->hasVariable( $class, 'AbsoluteHeight' ) )
00184 $absoluteHeight = $ini->variable( $class, 'AbsoluteHeight' );
00185
00186 if ( $namedParameters['family'] !== null )
00187 $family = $namedParameters["family"];
00188 if ( $namedParameters["pointsize"] !== null )
00189 $size = $namedParameters["pointsize"];
00190 if ( $namedParameters["angle"] !== null )
00191 $angle = $namedParameters["angle"];
00192 if ( $namedParameters["x"] !== null )
00193 $xadj = $namedParameters["x"];
00194 if ( $namedParameters["y"] !== null )
00195 $yadj = $namedParameters["y"];
00196 if ( $namedParameters["w"] !== null )
00197 $wadj = $namedParameters["w"];
00198 if ( $namedParameters["h"] !== null )
00199 $hadj = $namedParameters["h"];
00200 if ( $namedParameters["usecache"] !== null )
00201 $usecache = $namedParameters["usecache"];
00202 if ( $namedParameters["bgcolor"] !== null )
00203 $bgcol = $this->decodeColor( $namedParameters["bgcolor"] );
00204 if ( $namedParameters["textcolor"] !== null )
00205 $textcol = $this->decodeColor( $namedParameters["textcolor"] );
00206 $storeImage = $namedParameters["storeimage"];
00207
00208 $fontDir = false;
00209 foreach ( $this->FontDir as $fontPath )
00210 {
00211 if ( eZImageFont::exists( $family, $fontPath ) )
00212 {
00213 $fontDir = $fontPath;
00214 break;
00215 }
00216 }
00217 if ( !$fontDir )
00218 return;
00219 $font = new eZImageFont( $family, $size, $fontDir, $xadj, $yadj );
00220
00221 if ( $bgcol === null )
00222 $bgcol = $this->color( "bgcolor" );
00223 if ( !is_array( $bgcol ) or
00224 count( $bgcol ) < 3 )
00225 $bgcol = array( 255, 255, 255 );
00226 if ( $textcol === null )
00227 $textcol = $this->color( "textcolor" );
00228 if ( !is_array( $textcol ) or
00229 count( $textcol ) < 3 )
00230 $textcol = array( 0, 0, 0 );
00231
00232 $alternativeText = htmlspecialchars( $inputValue );
00233 if ( is_string( $usecache ) )
00234 $md5Text = $usecache;
00235 else
00236 $md5Text = md5( $inputValue . $family . $size . $angle . $xadj . $yadj . $wadj . $hadj . $absoluteWidth . $absoluteHeight . implode( ",", $bgcol ) . implode( ",", $textcol ) );
00237 if ( is_string( $usecache ) or !$usecache or
00238 !$this->hasImage( $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs ) )
00239 {
00240 $layer =& eZImageTextLayer::createForText( $inputValue, $font,
00241 $wadj, $hadj, $angle,
00242 $absoluteWidth, $absoluteHeight );
00243 if ( !$layer )
00244 {
00245 $tpl->error( $operatorName, "Could not open font \"$family\", no image created", $placement );
00246 return;
00247 }
00248 $layer->allocateColor( 'bgcol', $bgcol[0], $bgcol[1], $bgcol[2] );
00249 $layer->allocateColor( 'textcol', $textcol[0], $textcol[1], $textcol[2] );
00250 $layer->setTextColor( 'textcol' );
00251
00252 if ( $storeImage )
00253 $this->storeImage( $layer, $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs );
00254 $layer->destroy();
00255 }
00256 else
00257 {
00258 $layer =& $this->loadImage( $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs );
00259 }
00260 $layer->setAlternativeText( $alternativeText );
00261 $inputValue = $layer;
00262 }
00263
00264 else if ( $operatorName == 'image' )
00265 {
00266 $useCache = $this->UseCache;
00267 $image = new eZImageObject();
00268 $md5Input = "image\n";
00269 $alternativeText = '';
00270 $this->readImageParameters( $tpl, $image, $operatorParameters, $rootNamespace, $currentNamespace, $md5Input, $alternativeText,
00271 $placement );
00272 $image->setAlternativeText( $alternativeText );
00273 $md5Text = md5( $md5Input );
00274 if ( !$useCache or
00275 !$this->hasImage( $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs ) )
00276 {
00277 $this->storeImage( $image, $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs );
00278 $image->destroy();
00279 $inputValue = $image;
00280 }
00281 else
00282 {
00283 $this->setLoadImage( $image, $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs );
00284 $image->load();
00285 $inputValue = $image;
00286 }
00287 }
00288 else if ( $operatorName == 'imagefile' )
00289 {
00290 $file =& $namedParameters['filename'];
00291 $options =& $namedParameters['options'];
00292 $dir = '';
00293 if ( preg_match( "#^(.+)/([^/]+)$#", $file, $matches ) )
00294 {
00295 $dir = $matches[1];
00296 $file = $matches[2];
00297 }
00298
00299 $layer =& eZImageLayer::createForFile( $file, $dir );
00300 $alternativeText = $file;
00301 if ( preg_match( "#(.+)\.([^.]+)$#", $file, $matches ) )
00302 $alternativeText = $matches[1];
00303 $layer->setAlternativeText( $alternativeText );
00304 $inputValue = $layer;
00305 }
00306 }
00307
00308
00309
00310
00311 function &operatorList()
00312 {
00313 return $this->Operators;
00314 }
00315
00316
00317
00318
00319 function namedParameterPerOperator()
00320 {
00321 return true;
00322 }
00323
00324
00325
00326
00327 function namedParameterList()
00328 {
00329 return array( 'texttoimage' => array( "class" => array( 'type' => 'string',
00330 'required' => false,
00331 'default' => $this->DefaultClass ),
00332 "family" => array( "type" => "string",
00333 "required" => false,
00334 "default" => null ),
00335 "pointsize" => array( "type" => "integer",
00336 "required" => false,
00337 "default" => null ),
00338 "angle" => array( "type" => "integer",
00339 "required" => false,
00340 "default" => null ),
00341 "bgcolor" => array( "type" => "mixed",
00342 "required" => false,
00343 "default" => null ),
00344 "textcolor" => array( "type" => "mixed",
00345 "required" => false,
00346 "default" => null ),
00347 "x" => array( "type" => "integer",
00348 "required" => false,
00349 "default" => null ),
00350 "y" => array( "type" => "integer",
00351 "required" => false,
00352 "default" => null ),
00353 "w" => array( "type" => "integer",
00354 "required" => false,
00355 "default" => null ),
00356 "h" => array( "type" => "integer",
00357 "required" => false,
00358 "default" => null ),
00359 "usecache" => array( "type" => "boolean",
00360 "required" => false,
00361 "default" => null ),
00362 "storeimage" => array( "type" => "boolean",
00363 "required" => false,
00364 "default" => true )
00365 ),
00366 'imagefile' => array( 'filename' => array( 'type' => 'string',
00367 'required' => true ),
00368 'options' => array( 'type' => 'array',
00369 'default' => array(),
00370 'required' => false ) ) );
00371 }
00372
00373
00374
00375
00376
00377
00378 function fontDir()
00379 {
00380 return $this->FontDir;
00381 }
00382
00383
00384
00385
00386
00387 function cacheDir()
00388 {
00389 return $this->CacheDir;
00390 }
00391
00392
00393
00394
00395
00396 function htmlDir()
00397 {
00398 return $this->HTMLDir;
00399 }
00400
00401
00402
00403
00404
00405 function family()
00406 {
00407 return $this->Family;
00408 }
00409
00410
00411
00412
00413
00414 function pointSize()
00415 {
00416 return $this->PointSize;
00417 }
00418
00419
00420
00421
00422 function angle()
00423 {
00424 return $this->Angle;
00425 }
00426
00427
00428
00429
00430
00431 function xAdjustment()
00432 {
00433 return $this->XAdjust;
00434 }
00435
00436
00437
00438
00439
00440 function yAdjustment()
00441 {
00442 return $this->YAdjust;
00443 }
00444
00445
00446
00447
00448
00449 function widthAdjustment()
00450 {
00451 return $this->WAdjust;
00452 }
00453
00454
00455
00456
00457
00458 function heightAdjustment()
00459 {
00460 return $this->HAdjust;
00461 }
00462
00463
00464
00465
00466 function useCache()
00467 {
00468 return $this->UseCache;
00469 }
00470
00471
00472
00473
00474 function colors()
00475 {
00476 return $this->Colors;
00477 }
00478
00479
00480
00481
00482
00483 function decodeColor( $col )
00484 {
00485 $decode = null;
00486 if ( is_array( $col ) )
00487 $decode = $col;
00488 else if ( is_string( $col ) )
00489 {
00490 if ( preg_match( "/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/", $col, $regs ) )
00491 $decode = array( hexdec( $regs[1] ), hexdec( $regs[2] ), hexdec( $regs[3] ) );
00492 }
00493 return $decode;
00494 }
00495
00496
00497
00498
00499 function color( $colname )
00500 {
00501 if ( isset( $this->Colors[$colname] ) )
00502 {
00503 $col = $this->Colors[$colname];
00504 return $this->decodeColor( $col );
00505 }
00506 return null;
00507 }
00508
00509
00510
00511
00512
00513 function setFontDir( $dir )
00514 {
00515 $this->FontDir = $dir;
00516 }
00517
00518
00519
00520
00521
00522 function setCacheDir( $dir )
00523 {
00524 $this->CacheDir = $dir;
00525 }
00526
00527
00528
00529
00530
00531 function setHTMLDir( $dir )
00532 {
00533 $this->HTMLDir = $dir;
00534 }
00535
00536
00537
00538
00539 function setFamily( $fam )
00540 {
00541 $this->Family = $fam;
00542 }
00543
00544
00545
00546
00547 function setPointSize( $size )
00548 {
00549 $this->PointSize = $size;
00550 }
00551
00552
00553
00554
00555 function setAngle( $ang )
00556 {
00557 $this->Angle = $ang;
00558 }
00559
00560
00561
00562
00563
00564 function setXAdjustment( $x )
00565 {
00566 $this->XAdjust = $x;
00567 }
00568
00569
00570
00571
00572
00573 function setYAdjustment( $y )
00574 {
00575 $this->YAdjust = $y;
00576 }
00577
00578
00579
00580
00581
00582 function setWidthAdjustment( $w )
00583 {
00584 $this->WAdjust = $w;
00585 }
00586
00587
00588
00589
00590
00591 function setHeightAdjustment( $h )
00592 {
00593 $this->HAdjust = $h;
00594 }
00595
00596
00597
00598
00599
00600 function setUseCache( $use )
00601 {
00602 $this->UseCache = $use;
00603 }
00604
00605
00606
00607
00608
00609 function setColors( $cols )
00610 {
00611 $this->Colors = $cols;
00612 }
00613
00614
00615
00616
00617
00618
00619 function setColor( $colname, $colval )
00620 {
00621 $this->Colors[$colname] = $colval;
00622 }
00623
00624 function hasImage( $dirs, $base, $md5Text, $alternativeText, $imageType )
00625 {
00626 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
00627 "#__+#",
00628 "#_$#" ),
00629 array( '_',
00630 '_',
00631 '' ),
00632 $alternativeText );
00633 $file = "$name.$imageType";
00634 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
00635 $filePath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text, $file ) );
00636 return file_exists( $filePath );
00637 }
00638
00639 function storeImage( &$image, $dirs, $base, $md5Text, $alternativeText, $imageType )
00640 {
00641 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
00642 "#__+#",
00643 "#_$#" ),
00644 array( '_',
00645 '_',
00646 '' ),
00647 $alternativeText );
00648 $file = "$name.$imageType";
00649 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
00650 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
00651 if ( !file_exists( $dirPath ) )
00652 {
00653 $ini =& eZINI::instance();
00654 $mod = $ini->variable( 'FileSettings', 'StorageDirPermissions' );
00655 eZDir::mkdir( $dirPath, octdec( $mod ), true );
00656 }
00657 $image->store( $file, $dirPath, $imageType );
00658 }
00659
00660 function setLoadImage( &$image, $dirs, $base, $md5Text, $alternativeText, $imageType )
00661 {
00662 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
00663 "#__+#",
00664 "#_$#" ),
00665 array( '_',
00666 '_',
00667 '' ),
00668 $alternativeText );
00669 $file = "$name.$imageType";
00670 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
00671 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
00672 $filePath = eZDir::path( array( $dirPath, $file ) );
00673 if ( !file_exists( $filePath ) )
00674 return null;
00675 $image->setStoredFile( $file, $dirPath, $imageType );
00676 }
00677
00678 function &loadImage( $dirs, $base, $md5Text, $alternativeText, $imageType )
00679 {
00680 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
00681 "#__+#",
00682 "#_$#" ),
00683 array( '_',
00684 '_',
00685 '' ),
00686 $alternativeText );
00687 $file = "$name.$imageType";
00688 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
00689 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
00690 $filePath = eZDir::path( array( $dirPath, $file ) );
00691 if ( !file_exists( $filePath ) )
00692 $layer = null;
00693 else
00694 $layer =& eZImageLayer::createForFile( $file, $dirPath, $this->StoreAs );
00695 return $layer;
00696 }
00697
00698 function readImageParameters( &$tpl, &$image, &$operatorParameters, $rootNamespace, $currentNamespace, &$md5Input, &$alternativeText,
00699 $placement )
00700 {
00701 $imageAlternativeText = false;
00702 foreach ( array_keys( $operatorParameters ) as $operatorParameterKey )
00703 {
00704 $operatorParameter =& $tpl->elementValue( $operatorParameters[$operatorParameterKey], $rootNamespace, $currentNamespace, $placement );
00705 unset( $imageLayer );
00706 $imageLayer = null;
00707 $imageParameters = array();
00708 if ( is_string( $operatorParameter ) )
00709 {
00710 $imageAlternativeText = $operatorParameter;
00711 }
00712 else if ( is_array( $operatorParameter ) )
00713 {
00714 $imageLayer =& $operatorParameter[0];
00715 $imageParameterSource = $operatorParameter[1];
00716 if ( isset( $imageParameterSource['transparency'] ) )
00717 $imageParameters['transparency'] = $imageParameterSource['transparency'];
00718 if ( isset( $imageParameterSource['halign'] ) or
00719 isset( $imageParameterSource['valign'] ) or
00720 isset( $imageParameterSource['x'] ) or
00721 isset( $imageParameterSource['y'] ) )
00722 {
00723 $xAlignment = EZ_IMAGE_ALIGN_AXIS_NONE;
00724 $yAlignment = EZ_IMAGE_ALIGN_AXIS_NONE;
00725 $xPlacement = EZ_IMAGE_PLACE_CONSTANT;
00726 $yPlacement = EZ_IMAGE_PLACE_CONSTANT;
00727 $xPos = 0;
00728 $yPos = 0;
00729 if ( isset( $imageParameterSource['halign'] ) )
00730 {
00731 $alignmentText = strtolower( $imageParameterSource['halign'] );
00732 switch ( $alignmentText )
00733 {
00734 case 'left':
00735 {
00736 $xAlignment = EZ_IMAGE_ALIGN_AXIS_START;
00737 } break;
00738 case 'right':
00739 {
00740 $xAlignment = EZ_IMAGE_ALIGN_AXIS_STOP;
00741 } break;
00742 case 'center':
00743 {
00744 $xAlignment = EZ_IMAGE_ALIGN_AXIS_CENTER;
00745 } break;
00746 }
00747 }
00748 if ( isset( $imageParameterSource['valign'] ) )
00749 {
00750 $alignmentText = strtolower( $imageParameterSource['valign'] );
00751 switch ( $alignmentText )
00752 {
00753 case 'top':
00754 {
00755 $yAlignment = EZ_IMAGE_ALIGN_AXIS_START;
00756 } break;
00757 case 'bottom':
00758 {
00759 $yAlignment = EZ_IMAGE_ALIGN_AXIS_STOP;
00760 } break;
00761 case 'center':
00762 {
00763 $yAlignment = EZ_IMAGE_ALIGN_AXIS_CENTER;
00764 } break;
00765 }
00766 }
00767 if ( isset( $imageParameterSource['x'] ) )
00768 {
00769 $xPos = $imageParameterSource['x'];
00770 $xPlacement = EZ_IMAGE_PLACE_CONSTANT;
00771 }
00772 if ( isset( $imageParameterSource['xrel'] ) )
00773 {
00774 $xPos = $imageParameterSource['xrel'];
00775 $xPlacement = EZ_IMAGE_PLACE_RELATIVE;
00776 }
00777 if ( isset( $imageParameterSource['y'] ) )
00778 {
00779 $yPos = $imageParameterSource['y'];
00780 $yPlacement = EZ_IMAGE_PLACE_CONSTANT;
00781 }
00782 if ( isset( $imageParameterSource['yrel'] ) )
00783 {
00784 $yPos = $imageParameterSource['yrel'];
00785 $yPlacement = EZ_IMAGE_PLACE_RELATIVE;
00786 }
00787 $x = array( 'alignment' => $xAlignment,
00788 'placement' => $xPlacement,
00789 'value' => $xPos );
00790 $y = array( 'alignment' => $yAlignment,
00791 'placement' => $yPlacement,
00792 'value' => $yPos );
00793 $imageParameters['x'] = $x;
00794 $imageParameters['y'] = $y;
00795 }
00796 }
00797 else
00798 $imageLayer =& $operatorParameter;
00799 if ( $imageLayer !== null and
00800 $image->appendLayer( $imageLayer, $imageParameters ) )
00801 {
00802 $layerText = trim( $imageLayer->alternativeText() );
00803 if ( $layerText != '' )
00804 {
00805 if ( $alternativeText != '' )
00806 $alternativeText .= '-';
00807 $alternativeText .= $layerText;
00808 }
00809 $md5Input .= $imageLayer->attribute( 'imagepath' );
00810 $xAlignment = EZ_IMAGE_ALIGN_AXIS_NONE;
00811 $yAlignment = EZ_IMAGE_ALIGN_AXIS_NONE;
00812 $xPlacement = EZ_IMAGE_PLACE_CONSTANT;
00813 $yPlacement = EZ_IMAGE_PLACE_CONSTANT;
00814 $xPos = 0;
00815 $yPos = 0;
00816 if ( isset( $imageParameters['x']['alignment'] ) )
00817 $xAlignment = $imageParameters['x']['alignment'];
00818 if ( isset( $imageParameters['y']['alignment'] ) )
00819 $yAlignment = $imageParameters['y']['alignment'];
00820 if ( isset( $imageParameters['x']['placement'] ) )
00821 $xPlacement = $imageParameters['x']['placement'];
00822 if ( isset( $imageParameters['y']['placement'] ) )
00823 $yPlacement = $imageParameters['y']['placement'];
00824 if ( isset( $imageParameters['x']['value'] ) )
00825 $xPos = $imageParameters['x']['value'];
00826 if ( isset( $imageParameters['y']['value'] ) )
00827 $yPos = $imageParameters['y']['value'];
00828 $md5Input .= "$xPos-$xAlignment-$xPlacement-$yPos-$yAlignment-$yPlacement\n";
00829 }
00830 }
00831 if ( $imageAlternativeText !== false )
00832 $alternativeText = $imageAlternativeText;
00833 }
00834
00835
00836
00837 var $Operators;
00838
00839 var $DefaultClass;
00840
00841 var $FontDir;
00842
00843 var $CacheDir;
00844
00845 var $HTMLDir;
00846
00847 var $Family;
00848
00849 var $PointSize;
00850
00851 var $Angle;
00852
00853 var $XAdjust;
00854
00855 var $YAdjust;
00856
00857 var $UseCache;
00858
00859 var $Colors;
00860
00861 var $ImageGDSupported;
00862
00863 var $StoreAs = 'png';
00864 }
00865
00866 ?>