/** * Generates HTML for a given template and weblog. */ function generate_html($template, $weblog) { global $Cfg, $db, $Weblogs, $Current_weblog, $set_output_paths, $template_html; // Generate some html $template_html = load_template($template); $Current_weblog = $weblog; // should be unset before each archive and frontpage.. $set_output_paths = FALSE; if (!$template_html) { ErrorOut("Could not load template file: <i>{$template}</i> [does not exist]"); } else { $output = "[[tick]]" . $template_html; $output = parse_step4($output); $output = tidy_html($output); } // Spam protection if ($Cfg["hashcash"] == 1) { $output = add_hashcash_topage($output); } // save the entry, if necessary.. if ($Weblogs[$Current_weblog]['live_entries'] != 1) { $filename = make_filename(); makedir($Weblogs[$Current_weblog]['entry_path']); debug("Write entry file: {$filename}"); if (strstr($filename, ".php") != false) { $output = prepend_spamblock_code($output); } write_file($filename, $output); } return $output; }
$watermarkHeight = $watermark->getImageHeight(); // Get original image sizes $imageWidth = $original->getImageWidth(); $imageHeight = $original->getImageHeight(); // Merge watermark in tiling mode for ($x = $initialX;; $x += $watermarkWidth + (int) $originY) { for ($y = $initialY;; $y += $watermarkHeight + (int) $originX) { $original->compositeImage($watermark, Imagick::COMPOSITE_DEFAULT, $x, $y); if ($y > $imageHeight) { break; } } if ($x > $imageWidth) { break; } } } else { // Merge watermark in normal mode $original->compositeImage($watermark, Imagick::COMPOSITE_DEFAULT, $originX, $originY); } // Make flat image $original->flattenImages(); // Make filename and filedir $file_name = make_filename($originalImagePath, 'png'); $file_dir = get_download_filedir($file_name); // Save image $original->setImageFormat('png'); $original->writeImage($file_dir); // Send image name to user send_filename($file_name); }