function apply(lmbAbstractImageContainer $container) { $width = $container->getWidth(); $height = $container->getHeight(); $wm_cont = new lmbGdImageContainer(); $wm_cont->load($this->getWaterMark()); $wm_width = $this->getXCenter() ? $wm_cont->getWidth() : false; $wm_height = $this->getYCenter() ? $wm_cont->getHeight() : false; list($x, $y) = $this->calcPosition($this->getX(), $this->getY(), $width, $height, $wm_width, $wm_height); imagecopymerge($container->getResource(), $wm_cont->getResource(), $x, $y, 0, 0, $wm_cont->getWidth(), $wm_cont->getHeight(), 100 - $this->getOpacity()); }
function isSupportConversion($file, $src_type = '', $dest_type = '') { if (!$src_type) { $imginfo = @getimagesize($file); if (!$imginfo) { throw new lmbFileNotFoundException($file); } $src_type = lmbGdImageContainer::convertImageType($imginfo[2]); } if (!$dest_type) { $dest_type = $src_type; } return lmbGdImageContainer::supportLoadType($src_type) && lmbGdImageContainer::supportSaveType($dest_type); }