Location: PHPKode > projects > Nukequiz > html/modules/Nukequiz/admin/NQAAddWatermark.php
<?php
/*****************************************************************/
/* Nukequiz (tm)    v 3.1.0                                		 */
/* By: Kissoftware (hide@address.com)      		     */
/* http://www.kissoftware.org.uk                           		 */
/* http://www.kissoftware.co.uk                       		     */
/* Copyright © 2003-2008 by Kissoftware         				 */
/* See Docs For Information & Credits                 			 */
/* For More information Visit Forums Or The Online Help Manual	 */
/*****************************************************************/
$pagetitle = _NQ_ADMINADDWATERMARK;
$imagesdir = $nq_config['images_directory'];
$upload_dir = "modules/$module_name/$imagesdir/$quizdir";///Upload Directory for Images
include("header.php");
nqmenuheader();
OpenTable();
$handle=opendir($upload_dir);
unlink("$upload_dir/watermark.txt");
$x = 0;
$a = 0;
echo "<br><center><font class='title'>"._NQ_ADDWATERMARKCOPY."&nbsp;:&nbsp;$title</font>";
echo "&nbsp;&nbsp;[&nbsp;$quizdir&nbsp;]</center>";
echo "<br><center><table width='90%' cellpadding='2' cellspacing='2' border='0'>";
while (false !== ($file = readdir($handle))){
if ($a == 0) { echo "<tr>"; }
if ($file != "." && $file != ".." && $file!= "thumbs"){
if(!ereg(".gif|.png|.jpg",$file))  {
echo "<td align='center'>Non image file<br>$file</td>";
}
else {
$count = $count+1;
$watermark = imagecreatefrompng("modules/$module_name/images/watermark.png");  
$watermark_width = imagesx($watermark);  
$watermark_height = imagesy($watermark);  
$image = imagecreatetruecolor($watermark_width, $watermark_height);  
$image = imagecreatefromjpeg($upload_dir."/".$file);  
$size = getimagesize($upload_dir."/".$file);  
$dest_x = $size[0] - $watermark_width - 5;  
$dest_y = $size[1] - $watermark_height - 5; 
imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height); 
$newFile = $upload_dir."/".$file;
imagejpeg($image,$newFile,100);
echo "<td align='center'><img src='$newFile' width='60'><br>$file</td>";
$a++;
if ($a == 6) { echo "</tr>"; $a = 0; }
imagedestroy($image);
imagedestroy($watermark);

}
}
}
if ($a == 1) { echo "<td width='25%'>&nbsp;</td></tr>"; } else { echo "</tr>"; }
closedir($handle);
echo "</table><br><b>[&nbsp;</b><a href='".$admin_file.".php?op=nqviewquizlist'>"._NQ_OK."</a>&nbsp;<b>]</b><br><br></center>";
CloseTable();
include ('footer.php');
?>
Return current item: Nukequiz