/** * The media firewall passes in an image * this function can manipulate the image however it wants * before returning it back to the media firewall * * @param resource $im * @param Tree $tree * * @return resource */ function applyWatermark($im, Tree $tree) { // text to watermark with $word1_text = $tree->getTitle(); // maximum font size for “word1” ; will be automaticaly reduced to fit in the image $word1_maxsize = 100; // rgb color codes for text $word1_color = '0,0,0'; // ttf font file to use $word1_font = WT_ROOT . Config::FONT_DEJAVU_SANS_TTF; // vertical position for the text to past; possible values are: top, middle or bottom, across $word1_vpos = 'across'; // horizontal position for the text to past in media file; possible values are: left, right, top2bottom, bottom2top // this value is used only if $word1_vpos=across $word1_hpos = 'left'; $word2_text = $_SERVER['HTTP_HOST']; $word2_maxsize = 20; $word2_color = '0,0,0'; $word2_font = WT_ROOT . Config::FONT_DEJAVU_SANS_TTF; $word2_vpos = 'top'; $word2_hpos = 'top2bottom'; embedText($im, $word1_text, $word1_maxsize, $word1_color, $word1_font, $word1_vpos, $word1_hpos); embedText($im, $word2_text, $word2_maxsize, $word2_color, $word2_font, $word2_vpos, $word2_hpos); return $im; }