function addTag($srcPath, $dstPath)
{
$srcImage = new Image($srcPath);
$tagImagePath = CODE_ROOT_DIR . "uploads/custom/" . Config::get("watermarkImageSrc");
if (!file_exists($tagImagePath)) {
return;
}
$tagImage = new Image($tagImagePath);
list($posV, $posH) = explode(",", Config::get("imageWatermarkPosition"));
$tagMarginH = 5;
$tagMarginV = 5;
if ($posH == "l") {
$tagPositionX = 0 + $tagMarginH;
} else {
$tagPositionX = max($srcImage->getWidth() - $tagImage->getWidth() - $tagMarginH, 0);
}
if ($posV == "t") {
$tagPositionY = 0 + $tagMarginV;
} else {
$tagPositionY = max($srcImage->getHeight() - $tagImage->getHeight() - $tagMarginV, 0);
}
imagecopyresampled($srcImage->im, $tagImage->im, $tagPositionX, $tagPositionY, 0, 0, $tagImage->getWidth(), $tagImage->getHeight(), $tagImage->getWidth(), $tagImage->getHeight());
$srcImage->setPath($dstPath);
$srcImage->saveToFile();
}