Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eztemplateimageoperator.php
Go to the documentation of this file.
1 <?php
23 class eZTemplateImageOperator
24 {
25 public $WAdjust;
26 public $HAdjust;
27 public $MissingGDFunctions;
35 public function __construct( $texttoimageName = "texttoimage",
36 $imageName = "image",
37 $imagefileName = "imagefile" )
38 {
39 $this->Operators = array( $texttoimageName,
40 $imageName,
41 $imagefileName );
42
43 $ini = eZINI::instance( 'texttoimage.ini' );
44 $fontDirs = $ini->variable( "PathSettings", "FontDir" );
45 $this->FontDir = array();
46 foreach ( $fontDirs as $fontDir )
47 {
48 $this->FontDir[] = $fontDir;
49 }
50 $this->CacheDir = $ini->variable( "PathSettings", "CacheDir" );
51 $this->HTMLDir = eZSys::wwwDir() . $ini->variable( "PathSettings", "HtmlDir" );
52
53 $this->DefaultClass = 'default';
54 $this->Family = "arial";
55 $this->Colors = array( "bgcolor" => array( 255, 255, 255 ),
56 "textcolor" => array( 0, 0, 0 ) );
57 $this->PointSize = 12;
58 $this->Angle = 0;
59 $this->XAdjust = 0;
60 $this->YAdjust = 0;
61 $this->WAdjust = 0;
62 $this->HAdjust = 0;
63 $this->UseCache = true;
64 if ( $ini->variable( "ImageSettings", "UseCache" ) == "disabled" )
65 $this->UseCache = false;
66
67 $functions = array( "ImageTTFBBox",
68 "ImageCreate",
69 "ImageColorAllocate",
70 "ImageColorAllocate",
71 "ImageTTFText",
72 "ImagePNG",
73 "ImageJPEG",
74 "ImageDestroy" );
75 $this->MissingGDFunctions = array();
76 foreach ( $functions as $function )
77 {
78 if ( !function_exists( $function ) )
79 $this->MissingGDFunctions[] = $function;
80 }
81 $this->ImageGDSupported = count( $this->MissingGDFunctions ) == 0;
82 }
83
84 function operatorTemplateHints()
85 {
86 return array( 'texttoimage' => array( 'input' => true,
87 'output' => true,
88 'output-type' => array( 'objectproxy', 'keep' ),
89 'parameters' => true ),
90 'image' => array( 'input' => false,
91 'output' => true,
92 'output-type' => array( 'objectproxy', 'keep' ),
93 'parameters' => true ),
94 'imagefile' => array( 'input' => false,
95 'output' => true,
96 'output-type' => 'objectproxy',
97 'parameters' => true ) );
98 }
99
104 function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$inputValue, $namedParameters,
105 $placement )
106 {
107 if ( !$this->ImageGDSupported )
108 {
109 eZDebug::writeError( "$operatorName cannot be used since the following ImageGD functions are missing: " . implode( ', ', $this->MissingGDFunctions ) );
110 return;
111 }
112
113 if ( $operatorName == 'texttoimage' )
114 {
115 $class = $namedParameters['class'];
116
117 $family = $this->Family;
118 $size = $this->PointSize;
119 $angle = $this->Angle;
120 $xadj = $this->XAdjust;
121 $yadj = $this->YAdjust;
122 $wadj = $this->WAdjust;
123 $hadj = $this->HAdjust;
124 $usecache = $this->UseCache;
125 $bgcol = $this->color( "bgcolor" );
126 $textcol = $this->color( "textcolor" );
127
128 $ini = eZINI::instance( 'texttoimage.ini' );
129 $family = $ini->variable( 'DefaultSettings', 'Family' );
130 $size = $ini->variable( 'DefaultSettings', 'PointSize' );
131 $angle = $ini->variable( 'DefaultSettings', 'Angle' );
132 $xadj = $ini->variable( 'DefaultSettings', 'XAdjustment' );
133 $yadj = $ini->variable( 'DefaultSettings', 'YAdjustment' );
134 $wadj = $ini->variable( 'DefaultSettings', 'WidthAdjustment' );
135 $hadj = $ini->variable( 'DefaultSettings', 'HeightAdjustment' );
136 $bgcol = $this->decodeColor( $ini->variable( 'DefaultSettings', 'BackgroundColor' ) );
137 $textcol = $this->decodeColor( $ini->variable( 'DefaultSettings', 'TextColor' ) );
138
139 $absoluteWidth = false;
140 $absoluteHeight = false;
141
142 if ( $ini->hasVariable( $class, 'Family' ) )
143 $family = $ini->variable( $class, 'Family' );
144 if ( $ini->hasVariable( $class, 'PointSize' ) )
145 $size = $ini->variable( $class, 'PointSize' );
146 if ( $ini->hasVariable( $class, 'Angle' ) )
147 $angle = $ini->variable( $class, 'Angle' );
148 if ( $ini->hasVariable( $class, 'XAdjustment' ) )
149 $xadj = $ini->variable( $class, 'XAdjustment' );
150 if ( $ini->hasVariable( $class, 'YAdjustment' ) )
151 $yadj = $ini->variable( $class, 'YAdjustment' );
152 if ( $ini->hasVariable( $class, 'WidthAdjustment' ) )
153 $wadj = $ini->variable( $class, 'WidthAdjustment' );
154 if ( $ini->hasVariable( $class, 'HeightAdjustment' ) )
155 $hadj = $ini->variable( $class, 'HeightAdjustment' );
156 if ( $ini->hasVariable( $class, 'BackgroundColor' ) )
157 $bgcol = $this->decodeColor( $ini->variable( $class, 'BackgroundColor' ) );
158 if ( $ini->hasVariable( $class, 'TextColor' ) )
159 $textcol = $this->decodeColor( $ini->variable( $class, 'TextColor' ) );
160 if ( $ini->hasVariable( $class, 'AbsoluteWidth' ) )
161 $absoluteWidth = $ini->variable( $class, 'AbsoluteWidth' );
162 if ( $ini->hasVariable( $class, 'AbsoluteHeight' ) )
163 $absoluteHeight = $ini->variable( $class, 'AbsoluteHeight' );
164
165 if ( $namedParameters['family'] !== null )
166 $family = $namedParameters["family"];
167 if ( $namedParameters["pointsize"] !== null )
168 $size = $namedParameters["pointsize"];
169 if ( $namedParameters["angle"] !== null )
170 $angle = $namedParameters["angle"];
171 if ( $namedParameters["x"] !== null )
172 $xadj = $namedParameters["x"];
173 if ( $namedParameters["y"] !== null )
174 $yadj = $namedParameters["y"];
175 if ( $namedParameters["w"] !== null )
176 $wadj = $namedParameters["w"];
177 if ( $namedParameters["h"] !== null )
178 $hadj = $namedParameters["h"];
179 if ( $namedParameters["usecache"] !== null )
180 $usecache = $namedParameters["usecache"];
181 if ( $namedParameters["bgcolor"] !== null )
182 $bgcol = $this->decodeColor( $namedParameters["bgcolor"] );
183 if ( $namedParameters["textcolor"] !== null )
184 $textcol = $this->decodeColor( $namedParameters["textcolor"] );
185 $storeImage = $namedParameters["storeimage"];
186
187 $fontDir = false;
188 foreach ( $this->FontDir as $fontPath )
189 {
190 if ( eZImageFont::exists( $family, $fontPath ) )
191 {
192 $fontDir = $fontPath;
193 break;
194 }
195 }
196 if ( !$fontDir )
197 return;
198 $font = new eZImageFont( $family, $size, $fontDir, $xadj, $yadj );
199
200 if ( $bgcol === null )
201 $bgcol = $this->color( "bgcolor" );
202 if ( !is_array( $bgcol ) or
203 count( $bgcol ) < 3 )
204 $bgcol = array( 255, 255, 255 );
205 if ( $textcol === null )
206 $textcol = $this->color( "textcolor" );
207 if ( !is_array( $textcol ) or
208 count( $textcol ) < 3 )
209 $textcol = array( 0, 0, 0 );
210
211 $alternativeText = htmlspecialchars( $inputValue );
212 if ( is_string( $usecache ) )
213 $md5Text = $usecache;
214 else
215 $md5Text = md5( $inputValue . $family . $size . $angle . $xadj . $yadj . $wadj . $hadj . $absoluteWidth . $absoluteHeight . implode( ",", $bgcol ) . implode( ",", $textcol ) );
216 if ( is_string( $usecache ) or !$usecache or
217 !$this->hasImage( $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs ) )
218 {
219 $layer = eZImageTextLayer::createForText( $inputValue, $font,
220 $wadj, $hadj, $angle,
221 $absoluteWidth, $absoluteHeight );
222 if ( !$layer )
223 {
224 $tpl->error( $operatorName, "Could not open font \"$family\", no image created", $placement );
225 return;
226 }
227 $layer->allocateColor( 'bgcol', $bgcol[0], $bgcol[1], $bgcol[2] );
228 $layer->allocateColor( 'textcol', $textcol[0], $textcol[1], $textcol[2] );
229 $layer->setTextColor( 'textcol' );
230
231 if ( $storeImage )
232 $this->storeImage( $layer, $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs );
233 $layer->destroy();
234 }
235 else
236 {
237 $layer = $this->loadImage( $this->CacheDir, 'imagetext', $md5Text, $alternativeText, $this->StoreAs );
238 }
239 $layer->setAlternativeText( $alternativeText );
240 $inputValue = $layer;
241 }
242
243 else if ( $operatorName == 'image' )
244 {
245 $useCache = $this->UseCache;
246 $image = new eZImageObject();
247 $md5Input = "image\n";
248 $alternativeText = '';
249 $this->readImageParameters( $tpl, $image, $operatorParameters, $rootNamespace, $currentNamespace, $md5Input, $alternativeText,
250 $placement );
251 $image->setAlternativeText( $alternativeText );
252 $md5Text = md5( $md5Input );
253 if ( !$useCache or
254 !$this->hasImage( $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs ) )
255 {
256 $this->storeImage( $image, $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs );
257 $image->destroy();
258 $inputValue = $image;
259 }
260 else
261 {
262 $this->setLoadImage( $image, $this->CacheDir, 'imageobject', $md5Text, $alternativeText, $this->StoreAs );
263 $image->load();
264 $inputValue = $image;
265 }
266 }
267 else if ( $operatorName == 'imagefile' )
268 {
269 $file =& $namedParameters['filename'];
270 $options =& $namedParameters['options'];
271 $dir = '';
272 if ( preg_match( "#^(.+)/([^/]+)$#", $file, $matches ) )
273 {
274 $dir = $matches[1];
275 $file = $matches[2];
276 }
277
278 $layer = eZImageLayer::createForFile( $file, $dir );
279 $alternativeText = $file;
280 if ( preg_match( "#(.+)\.([^.]+)$#", $file, $matches ) )
281 $alternativeText = $matches[1];
282 $layer->setAlternativeText( $alternativeText );
283 $inputValue = $layer;
284 }
285 }
286
290 function operatorList()
291 {
292 return $this->Operators;
293 }
294
298 function namedParameterPerOperator()
299 {
300 return true;
301 }
302
306 function namedParameterList()
307 {
308 return array( 'texttoimage' => array( "class" => array( 'type' => 'string',
309 'required' => false,
310 'default' => $this->DefaultClass ),
311 "family" => array( "type" => "string",
312 "required" => false,
313 "default" => null ),
314 "pointsize" => array( "type" => "integer",
315 "required" => false,
316 "default" => null ),
317 "angle" => array( "type" => "integer",
318 "required" => false,
319 "default" => null ),
320 "bgcolor" => array( "type" => "mixed",
321 "required" => false,
322 "default" => null ),
323 "textcolor" => array( "type" => "mixed",
324 "required" => false,
325 "default" => null ),
326 "x" => array( "type" => "integer",
327 "required" => false,
328 "default" => null ),
329 "y" => array( "type" => "integer",
330 "required" => false,
331 "default" => null ),
332 "w" => array( "type" => "integer",
333 "required" => false,
334 "default" => null ),
335 "h" => array( "type" => "integer",
336 "required" => false,
337 "default" => null ),
338 "usecache" => array( "type" => "boolean",
339 "required" => false,
340 "default" => null ),
341 "storeimage" => array( "type" => "boolean",
342 "required" => false,
343 "default" => true )
344 ),
345 'imagefile' => array( 'filename' => array( 'type' => 'string',
346 'required' => true ),
347 'options' => array( 'type' => 'array',
348 'default' => array(),
349 'required' => false ) ) );
350 }
351
357 function fontDir()
358 {
359 return $this->FontDir;
360 }
361
366 function cacheDir()
367 {
368 return $this->CacheDir;
369 }
370
375 function htmlDir()
376 {
377 return $this->HTMLDir;
378 }
379
384 function family()
385 {
386 return $this->Family;
387 }
388
393 function pointSize()
394 {
395 return $this->PointSize;
396 }
397
401 function angle()
402 {
403 return $this->Angle;
404 }
405
410 function xAdjustment()
411 {
412 return $this->XAdjust;
413 }
414
419 function yAdjustment()
420 {
421 return $this->YAdjust;
422 }
423
428 function widthAdjustment()
429 {
430 return $this->WAdjust;
431 }
432
437 function heightAdjustment()
438 {
439 return $this->HAdjust;
440 }
441
445 function useCache()
446 {
447 return $this->UseCache;
448 }
449
453 function colors()
454 {
455 return $this->Colors;
456 }
457
462 function decodeColor( $col )
463 {
464 $decode = null;
465 if ( is_array( $col ) )
466 $decode = $col;
467 else if ( is_string( $col ) )
468 {
469 if ( preg_match( "/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/", $col, $regs ) )
470 $decode = array( hexdec( $regs[1] ), hexdec( $regs[2] ), hexdec( $regs[3] ) );
471 }
472 return $decode;
473 }
474
478 function color( $colname )
479 {
480 if ( isset( $this->Colors[$colname] ) )
481 {
482 $col = $this->Colors[$colname];
483 return $this->decodeColor( $col );
484 }
485 return null;
486 }
487
492 function setFontDir( $dir )
493 {
494 $this->FontDir = $dir;
495 }
496
501 function setCacheDir( $dir )
502 {
503 $this->CacheDir = $dir;
504 }
505
510 function setHTMLDir( $dir )
511 {
512 $this->HTMLDir = $dir;
513 }
514
518 function setFamily( $fam )
519 {
520 $this->Family = $fam;
521 }
522
526 function setPointSize( $size )
527 {
528 $this->PointSize = $size;
529 }
530
534 function setAngle( $ang )
535 {
536 $this->Angle = $ang;
537 }
538
543 function setXAdjustment( $x )
544 {
545 $this->XAdjust = $x;
546 }
547
552 function setYAdjustment( $y )
553 {
554 $this->YAdjust = $y;
555 }
556
561 function setWidthAdjustment( $w )
562 {
563 $this->WAdjust = $w;
564 }
565
570 function setHeightAdjustment( $h )
571 {
572 $this->HAdjust = $h;
573 }
574
579 function setUseCache( $use )
580 {
581 $this->UseCache = $use;
582 }
583
588 function setColors( $cols )
589 {
590 $this->Colors = $cols;
591 }
592
598 function setColor( $colname, $colval )
599 {
600 $this->Colors[$colname] = $colval;
601 }
602
603 function hasImage( $dirs, $base, $md5Text, $alternativeText, $imageType )
604 {
605 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
606 "#__+#",
607 "#_$#" ),
608 array( '_',
609 '_',
610 '' ),
611 $alternativeText );
612 $file = "$name.$imageType";
613 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
614 $filePath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text, $file ) );
615
616 $fileHandler = eZClusterFileHandler::instance( $filePath );
617 return $fileHandler->exists();
618 }
619
620 function storeImage( $image, $dirs, $base, $md5Text, $alternativeText, $imageType )
621 {
622 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
623 "#__+#",
624 "#_$#" ),
625 array( '_',
626 '_',
627 '' ),
628 $alternativeText );
629 $file = "$name.$imageType";
630 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
631 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
632 $image->store( $file, $dirPath, $imageType );
633
634 $fileHandler = eZClusterFileHandler::instance();
635 $filePath = eZDir::path( array( $dirPath, $file ) );
636 $mimeData = eZMimeType::findByURL( $filePath, true );
637 $fileHandler->fileStore( $filePath, 'texttoimage', false, $mimeData['name'] );
638 }
639
640 function setLoadImage( $image, $dirs, $base, $md5Text, $alternativeText, $imageType )
641 {
642 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
643 "#__+#",
644 "#_$#" ),
645 array( '_',
646 '_',
647 '' ),
648 $alternativeText );
649 $file = "$name.$imageType";
650 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
651 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
652 $filePath = eZDir::path( array( $dirPath, $file ) );
653 $fileHandler = eZClusterFileHandler::instance( $filePath );
654 if ( !$fileHandler->exists() )
655 {
656 return null;
657 }
658
659 // we use a local cache of the file, because the eZImage library only works on files on the file system
660 $fileHandler->fetch( true );
661 $image->setStoredFile( $file, $dirPath, $imageType );
662 }
663
664 function loadImage( $dirs, $base, $md5Text, $alternativeText, $imageType )
665 {
666 $name = preg_replace( array( "#[^a-zA-Z0-9_-]+#",
667 "#__+#",
668 "#_$#" ),
669 array( '_',
670 '_',
671 '' ),
672 $alternativeText );
673 $file = "$name.$imageType";
674 $splitMD5Path = eZDir::getPathFromFilename( $md5Text );
675 $dirPath = eZDir::path( array( $dirs, $base, $splitMD5Path, $md5Text ) );
676 $filePath = eZDir::path( array( $dirPath, $file ) );
677
678 $fileHandler = eZClusterFileHandler::instance( $filePath );
679 if ( !$fileHandler->exists() )
680 {
681 return null;
682 }
683
684 // we use a local cache of the file, because the eZImage library only works on files on the file system
685 $fileHandler->fetch( true );
686 return eZImageLayer::createForFile( $file, $dirPath, $this->StoreAs );
687 }
688
689 function readImageParameters( $tpl, $image, $operatorParameters, $rootNamespace, $currentNamespace, &$md5Input, &$alternativeText,
690 $placement )
691 {
692 $imageAlternativeText = false;
693 foreach ( array_keys( $operatorParameters ) as $operatorParameterKey )
694 {
695 $operatorParameter = $tpl->elementValue( $operatorParameters[$operatorParameterKey], $rootNamespace, $currentNamespace, $placement );
696 unset( $imageLayer );
697 $imageLayer = null;
698 $imageParameters = array();
699 if ( is_string( $operatorParameter ) )
700 {
701 $imageAlternativeText = $operatorParameter;
702 }
703 else if ( is_array( $operatorParameter ) )
704 {
705 $imageLayer = $operatorParameter[0];
706 $imageParameterSource = $operatorParameter[1];
707 if ( isset( $imageParameterSource['transparency'] ) )
708 $imageParameters['transparency'] = $imageParameterSource['transparency'];
709 if ( isset( $imageParameterSource['halign'] ) or
710 isset( $imageParameterSource['valign'] ) or
711 isset( $imageParameterSource['x'] ) or
712 isset( $imageParameterSource['y'] ) )
713 {
714 $xAlignment = eZImageObject::ALIGN_AXIS_NONE;
715 $yAlignment = eZImageObject::ALIGN_AXIS_NONE;
716 $xPlacement = eZImageObject::PLACE_CONSTANT;
717 $yPlacement = eZImageObject::PLACE_CONSTANT;
718 $xPos = 0;
719 $yPos = 0;
720 if ( isset( $imageParameterSource['halign'] ) )
721 {
722 $alignmentText = strtolower( $imageParameterSource['halign'] );
723 switch ( $alignmentText )
724 {
725 case 'left':
726 {
727 $xAlignment = eZImageObject::ALIGN_AXIS_START;
728 } break;
729 case 'right':
730 {
731 $xAlignment = eZImageObject::ALIGN_AXIS_STOP;
732 } break;
733 case 'center':
734 {
735 $xAlignment = eZImageObject::ALIGN_AXIS_CENTER;
736 } break;
737 }
738 }
739 if ( isset( $imageParameterSource['valign'] ) )
740 {
741 $alignmentText = strtolower( $imageParameterSource['valign'] );
742 switch ( $alignmentText )
743 {
744 case 'top':
745 {
746 $yAlignment = eZImageObject::ALIGN_AXIS_START;
747 } break;
748 case 'bottom':
749 {
750 $yAlignment = eZImageObject::ALIGN_AXIS_STOP;
751 } break;
752 case 'center':
753 {
754 $yAlignment = eZImageObject::ALIGN_AXIS_CENTER;
755 } break;
756 }
757 }
758 if ( isset( $imageParameterSource['x'] ) )
759 {
760 $xPos = $imageParameterSource['x'];
761 $xPlacement = eZImageObject::PLACE_CONSTANT;
762 }
763 if ( isset( $imageParameterSource['xrel'] ) )
764 {
765 $xPos = $imageParameterSource['xrel'];
766 $xPlacement = eZImageObject::PLACE_RELATIVE;
767 }
768 if ( isset( $imageParameterSource['y'] ) )
769 {
770 $yPos = $imageParameterSource['y'];
771 $yPlacement = eZImageObject::PLACE_CONSTANT;
772 }
773 if ( isset( $imageParameterSource['yrel'] ) )
774 {
775 $yPos = $imageParameterSource['yrel'];
776 $yPlacement = eZImageObject::PLACE_RELATIVE;
777 }
778 $x = array( 'alignment' => $xAlignment,
779 'placement' => $xPlacement,
780 'value' => $xPos );
781 $y = array( 'alignment' => $yAlignment,
782 'placement' => $yPlacement,
783 'value' => $yPos );
784 $imageParameters['x'] = $x;
785 $imageParameters['y'] = $y;
786 }
787 }
788 else
789 $imageLayer = $operatorParameter;
790 if ( $imageLayer !== null and
791 $image->appendLayer( $imageLayer, $imageParameters ) )
792 {
793 $layerText = trim( $imageLayer->alternativeText() );
794 if ( $layerText != '' )
795 {
796 if ( $alternativeText != '' )
797 $alternativeText .= '-';
798 $alternativeText .= $layerText;
799 }
800 $md5Input .= $imageLayer->attribute( 'imagepath' );
801 $xAlignment = eZImageObject::ALIGN_AXIS_NONE;
802 $yAlignment = eZImageObject::ALIGN_AXIS_NONE;
803 $xPlacement = eZImageObject::PLACE_CONSTANT;
804 $yPlacement = eZImageObject::PLACE_CONSTANT;
805 $xPos = 0;
806 $yPos = 0;
807 if ( isset( $imageParameters['x']['alignment'] ) )
808 $xAlignment = $imageParameters['x']['alignment'];
809 if ( isset( $imageParameters['y']['alignment'] ) )
810 $yAlignment = $imageParameters['y']['alignment'];
811 if ( isset( $imageParameters['x']['placement'] ) )
812 $xPlacement = $imageParameters['x']['placement'];
813 if ( isset( $imageParameters['y']['placement'] ) )
814 $yPlacement = $imageParameters['y']['placement'];
815 if ( isset( $imageParameters['x']['value'] ) )
816 $xPos = $imageParameters['x']['value'];
817 if ( isset( $imageParameters['y']['value'] ) )
818 $yPos = $imageParameters['y']['value'];
819 $md5Input .= "$xPos-$xAlignment-$xPlacement-$yPos-$yAlignment-$yPlacement\n";
820 }
821 }
822 if ( $imageAlternativeText !== false )
823 $alternativeText = $imageAlternativeText;
824 }
825
828 public $Operators;
830 public $DefaultClass;
832 public $FontDir;
834 public $CacheDir;
836 public $HTMLDir;
838 public $Family;
840 public $PointSize;
842 public $Angle;
844 public $XAdjust;
846 public $YAdjust;
848 public $UseCache;
850 public $Colors;
852 public $ImageGDSupported;
854 public $StoreAs = 'png';
855 }
856
857 ?>
eZClusterFileHandler\instance
static instance( $filename=false)
Definition: ezclusterfilehandler.php:21
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZDir\getPathFromFilename
static getPathFromFilename( $filename)
Definition: ezdir.php:41
eZDir\path
static path( $names, $includeEndSeparator=false, $type=self::SEPARATOR_UNIX)
Definition: ezdir.php:237
eZImageFont
Specifies a font used for drawing text.
Definition: ezimagefont.php:30
eZImageFont\exists
static exists( $fontFamily, $fontPath)
Definition: ezimagefont.php:174
eZImageLayer\createForFile
static createForFile( $fileName, $filePath, $fileType=false)
Definition: ezimagelayer.php:88
eZImageObject
Image object which handles image layers.
Definition: ezimageobject.php:19
eZImageObject\ALIGN_AXIS_STOP
const ALIGN_AXIS_STOP
Definition: ezimageobject.php:24
eZImageObject\PLACE_CONSTANT
const PLACE_CONSTANT
Definition: ezimageobject.php:31
eZImageObject\PLACE_RELATIVE
const PLACE_RELATIVE
Places the layer relative to the axis size.
Definition: ezimageobject.php:33
eZImageObject\ALIGN_AXIS_START
const ALIGN_AXIS_START
Definition: ezimageobject.php:23
eZImageObject\ALIGN_AXIS_NONE
const ALIGN_AXIS_NONE
Alignment values.
Definition: ezimageobject.php:22
eZImageObject\ALIGN_AXIS_CENTER
const ALIGN_AXIS_CENTER
Definition: ezimageobject.php:25
eZImageTextLayer\createForText
static createForText( $text, &$font, $widthAdjustment, $heightAdjustment, $angle, $absoluteWidth=false, $absoluteHeight=false)
Definition: ezimagetextlayer.php:131
eZMimeType\findByURL
static findByURL( $url, $returnDefault=true)
Definition: ezmimetype.php:227
eZSys\wwwDir
static wwwDir()
Definition: ezsys.php:582
eZTemplateImageOperator
Text to image conversion using operator "texttoimage".
Definition: eztemplateimageoperator.php:24
eZTemplateImageOperator\$Family
$Family
the default font family, default is "arial"
Definition: eztemplateimageoperator.php:838
eZTemplateImageOperator\cacheDir
cacheDir()
Definition: eztemplateimageoperator.php:366
eZTemplateImageOperator\setFamily
setFamily( $fam)
Definition: eztemplateimageoperator.php:518
eZTemplateImageOperator\$XAdjust
$XAdjust
the default font x adjustment, default is 0
Definition: eztemplateimageoperator.php:844
eZTemplateImageOperator\$FontDir
$FontDir
the directory were fonts are found, default is ""
Definition: eztemplateimageoperator.php:832
eZTemplateImageOperator\storeImage
storeImage( $image, $dirs, $base, $md5Text, $alternativeText, $imageType)
Definition: eztemplateimageoperator.php:620
eZTemplateImageOperator\fontDir
fontDir()
Definition: eztemplateimageoperator.php:357
eZTemplateImageOperator\setLoadImage
setLoadImage( $image, $dirs, $base, $md5Text, $alternativeText, $imageType)
Definition: eztemplateimageoperator.php:640
eZTemplateImageOperator\colors
colors()
Definition: eztemplateimageoperator.php:453
eZTemplateImageOperator\color
color( $colname)
Definition: eztemplateimageoperator.php:478
eZTemplateImageOperator\operatorTemplateHints
operatorTemplateHints()
Definition: eztemplateimageoperator.php:84
eZTemplateImageOperator\$Operators
$Operators
Definition: eztemplateimageoperator.php:828
eZTemplateImageOperator\$StoreAs
$StoreAs
Storage Format, default is "png".
Definition: eztemplateimageoperator.php:854
eZTemplateImageOperator\operatorList
operatorList()
Definition: eztemplateimageoperator.php:290
eZTemplateImageOperator\setPointSize
setPointSize( $size)
Definition: eztemplateimageoperator.php:526
eZTemplateImageOperator\yAdjustment
yAdjustment()
Definition: eztemplateimageoperator.php:419
eZTemplateImageOperator\setAngle
setAngle( $ang)
Definition: eztemplateimageoperator.php:534
eZTemplateImageOperator\family
family()
Definition: eztemplateimageoperator.php:384
eZTemplateImageOperator\$DefaultClass
$DefaultClass
The default class to use for text to image conversion.
Definition: eztemplateimageoperator.php:830
eZTemplateImageOperator\readImageParameters
readImageParameters( $tpl, $image, $operatorParameters, $rootNamespace, $currentNamespace, &$md5Input, &$alternativeText, $placement)
Definition: eztemplateimageoperator.php:689
eZTemplateImageOperator\$PointSize
$PointSize
the default font point size, default is 12
Definition: eztemplateimageoperator.php:840
eZTemplateImageOperator\hasImage
hasImage( $dirs, $base, $md5Text, $alternativeText, $imageType)
Definition: eztemplateimageoperator.php:603
eZTemplateImageOperator\heightAdjustment
heightAdjustment()
Definition: eztemplateimageoperator.php:437
eZTemplateImageOperator\$CacheDir
$CacheDir
the directory were cache files are created, default is ""
Definition: eztemplateimageoperator.php:834
eZTemplateImageOperator\loadImage
loadImage( $dirs, $base, $md5Text, $alternativeText, $imageType)
Definition: eztemplateimageoperator.php:664
eZTemplateImageOperator\modify
modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$inputValue, $namedParameters, $placement)
Definition: eztemplateimageoperator.php:104
eZTemplateImageOperator\setCacheDir
setCacheDir( $dir)
Definition: eztemplateimageoperator.php:501
eZTemplateImageOperator\$HTMLDir
$HTMLDir
the directory were html code finds the images, default is ""
Definition: eztemplateimageoperator.php:836
eZTemplateImageOperator\__construct
__construct( $texttoimageName="texttoimage", $imageName="image", $imagefileName="imagefile")
Definition: eztemplateimageoperator.php:35
eZTemplateImageOperator\$MissingGDFunctions
$MissingGDFunctions
Definition: eztemplateimageoperator.php:27
eZTemplateImageOperator\$Colors
$Colors
the color array, default is bgcolor=white and textcolor=black
Definition: eztemplateimageoperator.php:850
eZTemplateImageOperator\$YAdjust
$YAdjust
the default font y adjustment, default is 0
Definition: eztemplateimageoperator.php:846
eZTemplateImageOperator\angle
angle()
Definition: eztemplateimageoperator.php:401
eZTemplateImageOperator\setColors
setColors( $cols)
Definition: eztemplateimageoperator.php:588
eZTemplateImageOperator\useCache
useCache()
Definition: eztemplateimageoperator.php:445
eZTemplateImageOperator\$ImageGDSupported
$ImageGDSupported
Whether image GD is supported.
Definition: eztemplateimageoperator.php:852
eZTemplateImageOperator\setYAdjustment
setYAdjustment( $y)
Definition: eztemplateimageoperator.php:552
eZTemplateImageOperator\$HAdjust
$HAdjust
Definition: eztemplateimageoperator.php:26
eZTemplateImageOperator\$UseCache
$UseCache
whether to reuse cache files or not
Definition: eztemplateimageoperator.php:848
eZTemplateImageOperator\xAdjustment
xAdjustment()
Definition: eztemplateimageoperator.php:410
eZTemplateImageOperator\htmlDir
htmlDir()
Definition: eztemplateimageoperator.php:375
eZTemplateImageOperator\setWidthAdjustment
setWidthAdjustment( $w)
Definition: eztemplateimageoperator.php:561
eZTemplateImageOperator\setHTMLDir
setHTMLDir( $dir)
Definition: eztemplateimageoperator.php:510
eZTemplateImageOperator\setHeightAdjustment
setHeightAdjustment( $h)
Definition: eztemplateimageoperator.php:570
eZTemplateImageOperator\setUseCache
setUseCache( $use)
Definition: eztemplateimageoperator.php:579
eZTemplateImageOperator\$Angle
$Angle
the default font angle, default is 0
Definition: eztemplateimageoperator.php:842
eZTemplateImageOperator\setColor
setColor( $colname, $colval)
Definition: eztemplateimageoperator.php:598
eZTemplateImageOperator\namedParameterPerOperator
namedParameterPerOperator()
Definition: eztemplateimageoperator.php:298
eZTemplateImageOperator\decodeColor
decodeColor($col)
Definition: eztemplateimageoperator.php:462
eZTemplateImageOperator\pointSize
pointSize()
Definition: eztemplateimageoperator.php:393
eZTemplateImageOperator\widthAdjustment
widthAdjustment()
Definition: eztemplateimageoperator.php:428
eZTemplateImageOperator\namedParameterList
namedParameterList()
Definition: eztemplateimageoperator.php:306
eZTemplateImageOperator\$WAdjust
$WAdjust
Definition: eztemplateimageoperator.php:25
eZTemplateImageOperator\setFontDir
setFontDir( $dir)
Definition: eztemplateimageoperator.php:492
eZTemplateImageOperator\setXAdjustment
setXAdjustment( $x)
Definition: eztemplateimageoperator.php:543
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.