/** * apply automatic modifications of the uploaded images as specified in a ClusterTemplateItem. */ function applyAutoMod($filename) { global $c; $maxwidth = $this->pgnref->getOption("TEXT1"); $maxheight = $this->pgnref->getOption("TEXT2"); if (($maxwidth != "") || ($maxheight != "")) { $imageapi = new NXImageApi($c["devfilespath"]."orig_".$filename, $c["devfilespath"].$filename); if (stristr($maxwidth, "%") && stristr($maxheight, "%")) { $imageapi->resizeRelative($maxwidth, $maxheight); } else if (is_numeric($maxwidth) && is_numeric($maxwidth)) { $imageapi->resizeAbsolute($maxwidth, $maxheight); } $imageapi->save(); } }
/** * create the image * @param string Name and path of the image to create */ function createImage($imagename) { global $panic, $debug; $content = getDBCell("pgn_label", "CONTENT", "FKID = $this->fkid"); $image = new NXImageApi("", $imagename, false); $image->createCanvas($this->getOption("NUMBER2"),$this->getOption("NUMBER3"), $this->getOption("TEXT3")); $image->font = $this->getOption("TEXT4"); $image->fontsize = $this->getOption("NUMBER1"); $image->fontstyle = $this->getOption("TEXT5"); $image->gravity = $this->getOption("TEXT1"); $image->fillcolor = $this->getOption("TEXT2"); $image->drawText($content, 0, 0); $image->save(); }
/** * Paints a text as image. * All configuration variables must be set before! * @param string TExt to paint * @param integer Offset on X-Axis * @param integer Offset on Y-Axis */ function paint($text, $x=0, $y=0) { global $cds; $name = $this->getImageName($text); if ($name != "") { $image = new NXImageApi("", $cds->path."images/".$name, false); $image->createCanvas($this->width, $this->height, $this->bgcolor); $image->font = $this->font; $image->fontsize = $this->fontsize; $image->gravity = $this->gravity; $image->fillcolor = $this->textcolor; $image->fontstyle = $this->fontstyle; $image->drawText($text, $x, $y); $image->save(); } return '<img src="'.$cds->docroot.'images/'.$this->getImageName2($text).'" width="'.$this->width.'" height="'.$this->height.'" alt="'.$text.'" border="0">'; }