/**
* Creates an instance of this image class
*
- * @return $imageInstance An instance of this image class
+ * @param $templateInstance A template instance
+ * @return $imageInstance An instance of this image class
*/
- public final static function createPngImage() {
+ public final static function createPngImage(CompileableTemplate $templateInstance) {
// Get a new instance
$imageInstance = new PngImage();
+ // Set template instance
+ $imageInstance->setTemplateInstance($templateInstance);
+
+ // Set image type
+ $imageInstance->setImageType("png");
+
// Return the instance
return $imageInstance;
}
+
+ /**
+ * Finish this image by producing it
+ *
+ * @return void
+ */
+ public function finishImage () {
+ // Call parent method
+ parent::finishImage();
+
+ // Get a file name for our image
+ $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
+
+ // Finish the image and send it to a cache file
+ imagepng($this->getImageResource(), $cacheFile, 9, PNG_ALL_FILTERS);
+ }
}
// [EOF]