| Current Path : /var/www/html/mmishra/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/iiita/banner.php |
<?php
checkadmin($role);
$submit = $_POST["submit"];
$imgsrc = $_POST["imgsrc"];
if ($imgsrc) $file1 = 'bannersrc.jpg'; else $file1 = $_POST["file1"];
$file2 = $_POST["file2"];
$text = $_POST['text'];
$color = $_POST["color"];
$font = $_POST['font'];
$font_size = $_POST['font_size'];
$angle = $_POST['angle'];
$offset_x = $_POST['offset_x'];
$offset_y = $_POST['offset_y'];
$shadow_color = $_POST['shadow_color'];
$col_arr = array('Black','Green','Silver','Lime','Gray','Olive','White','Yellow','Maroon',
'Navy','Red','Blue','Purple','Teal','Fuchsia','Aqua');
$col_value = array("#000000","#008000","#C0C0C0","#00FF00", "#808080","#808000","#FFFFFF","#FFFF00","#800000",
"#000080","#FF0000","#0000FF","#800080","#008080","#FF00FF","#00FFFF");
//$col_arr = array('#000000','#FF0000','#00FF00','#0000FF','#FFFF00','#00FFFF','#FF00FF','#C0C0C0','#FFFFFF');
if ($submit == 'CREATE') {
//resize where storing tmp img file
//$tmpimg = tempnam("/srv/www/websites/ada/images", "TMP0");
//system("chmod 777 $tmpimg");
//$newfile = "banner.jpg";
//system("chmod 777 $newfile");
//$ext = strtolower(getFileExtension($filename));
//CONVERT IMAGE TO PNM
//@system("djpeg /srv/www/websites/ada/images/$filename >$tmpimg");
//scale image using pnmscale and output using cjpeg
//@system("pnmscale -xy 950 200 $tmpimg | cjpeg -smoo 10 -qual 50 >/srv/www/websites/ada/images/$newfile");
$droot = $_SERVER["DOCUMENT_ROOT"];
create_img("$droot/images/$file1","$droot/images/$file2",$text,$color,$font,$font_size,$angle,$offset_x,$offset_y,$shadow_color);
banner($file2);
}
?>
Please type organization TITLE to be printed over as title. Banner size on this site is 971x114 pixels.
<br>
Upload an image file named bannersrc.jpg to create your banner.
<br>
<img src='images/bannersrc.jpg' width='800' height='100'>
<script type="text/javascript">
<!--
/* If we try to set the font for document inline, we have to worry about nested quotations.
Thus I separated the code from the button.
*/
function hindiFace() {
document.form.text.style.fontFamily = '"Kruti Dev 010"';
}
//-->
</script>
<table class='normal'>
<?php
echo "<tr><td>Input file name</td><td><input type='radio' name='imgsrc' value='baseimg'>BannerSRC.jpg
<input type='radio' name='imgsrc' value='' checked>Another file stored on server
<input type='text' name='file1' value='$file1' size='20'></td></tr>
<tr><td>Output file name </td><td><input type='text' name='file2' value='$file2' size='40'></td></tr>
<tr><td>Language</td><td><input type='radio' name='font' value='arial.ttf' ";
if ($font == 'arial.ttf') echo 'checked';
echo "> English
<input type='radio' name='font' value='K010.ttf' style='font-face:\"Kruti Dev 010\"' onclick=\"hindiFace()\"";
if ($font != 'arial.ttf') echo 'checked';
echo "> Hindi </td></tr>
<tr><td>Text on Banner</td><td><select name='text'>";
$rs = mysql_query("select * from setup where setup_key in ('title','address','title_hindi')");
while ($o = mysql_fetch_object($rs)) {
echo "<option value='$o->setup_value'";
if ($text == $o->setup_value) echo ' selected';
echo ">$o->setup_value ($o->setup_key)</option>";
}
echo "</select></td></tr>
<tr><td>Text color</td><td><select name='color'>";
$i=0;
foreach ($col_value as $cl) {
echo "<option value='$cl'";
if ($color == $cl) echo " selected";
echo "><font color='$cl'>$col_arr[$i]</font></option>";
$i++;
}
echo "</select>
Shadow color <select name='shadow_color'>";
$i=0;
foreach ($col_value as $cl) {
echo "<option value='$cl'";
if ($shadow_color == $cl) echo " selected";
echo "><b style=\"color:$cl\">$col_arr[$i]</b></option>";
$i++;
}
echo "</select>
Font size <select name='font_size'>";
for ($i=10; $i<=42; $i++) {
echo "<option value='$i'";
if ($font_size == $i) echo " selected";
echo ">$i</option>";
}
echo "</select></td></tr>
<tr><td>Text angle</td><td><input type='text' name='angle' value='$angle' size='10'>
Offset X (100-800) <input type='text' name='offset_x' value='$offset_x' size='10'>
Offset Y (1-100) <input type='text' name='offset_y' value='$offset_y' size='10'> </td></tr>
</table>
<input type='submit' name='submit' value='CREATE' style='width:80px'>
Offset X, Y are measured from right, bottom corner of banner image<br>
<br>
<img src='images/$file2' width='800' height='100'>
<br>
Uploaded files <a href='documents/' target='_blank'>documents</a>, <a href='images/' target='_blank'>images</a>";