X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fimages%2Fextended%2Fclass_PngImage.php;h=e5f184d90b782882e53091f5afd872eb8162a51e;hp=4693a3d1633d2f785eb7f06ad2b2eef84c0d0c14;hb=8ff2f773e29b6628131d73271f5cac9b2756374e;hpb=00641698668a49acfc3e8445748cd85bb298bf2f diff --git a/inc/classes/main/images/extended/class_PngImage.php b/inc/classes/main/images/extended/class_PngImage.php index 4693a3d..e5f184d 100644 --- a/inc/classes/main/images/extended/class_PngImage.php +++ b/inc/classes/main/images/extended/class_PngImage.php @@ -41,15 +41,38 @@ class PngImage extends BaseImage { /** * 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]