PHP gevorderde |
|
Hmmz,
Het is idd zo maar toch wil dit niet werken:
<?php
ob_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>openWYSIWYG | Select Color</title>
</head>
<script language="JavaScript" type="text/javascript">
/* ---------------------------------------------------------------------- *\
Function : insertImage()
Description : Inserts image into the WYSIWYG.
\* ---------------------------------------------------------------------- */
function insertImage(url,alt,align,border,hspace,vspace) {
var image = '<img src="' + url + '" alt="' + alt + '" alignment="' + align + '" border="' + border + '" hspace="' + hspace + '" vspace="' + vspace + '"/>';
window.opener.insertHTML(image, 'text1');
window.close();
}
</script>
<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
$alt= $_POST['alt'];
$alignment= $_POST['alignment'];
$border = $_POST['borderThickness'];
$hspace = $_POST['horizontal'];
$vspace = $_POST['vertical'];
if(!empty($_POST['imageurl']))
{
$url = $_POST['imageurl'];
?>
<script type="text/javascript">
var uitvoeren = insertImage('<?php echo $url; ?>','<?php echo $alt; ?>','<?php echo $alignment; ?>','<?php echo $border; ?>','<?php echo $hspace; ?>','<?php echo $vspace; ?>');
</script>
<?php
}
elseif(!empty($_FILES['imageurl2']))
{
$url = $_FILES['imageurl'];
$van = $_FILES['imageurl2']['tmp_name'];
$bestand = $_FILES['imageurl2']['name'];
$naar = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand;
if(move_uploaded_file($van, $naar))
{
$url = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand;
?>
<script type="text/javascript">
var uitvoeren = insertImage('<?php echo $url; ?>','<?php echo $alignment; ?>','<?php echo $border; ?>','<?php echo $hspace; ?>','<?php echo $vspace; ?>');
</script>
<?php
}
else
{
echo 'mislukt';
}
}
else
{
?>
<script language="Javascript" type="text/javascript">
window.close();
</script>
<?php
}
}
else
{
?>
<table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;"><form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data"><tr><td>
<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Image:</span>
<table width="380" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Image URL:</td>
<td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="text" name="imageurl" id="imageurl" value="" style="font-size: 10px; width: 100%;"></td>
</tr>
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Locale afbeelding:</td>
<td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="file" name="imageurl2" id="imageurl2" style="font-size: 10px; width: 100%;"></td>
</tr>
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Alternate Text:</td>
<td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="alt" id="alt" value="" style="font-size: 10px; width: 100%;"></td>
</tr>
</table>
<table width="380" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;"><tr><td>
<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Layout:</span>
<table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="100">Alignment:</td>
<td style="padding-bottom: 2px; padding-top: 0px;" width="85">
<select name="alignment" id="alignment" style="font-family: arial, verdana, helvetica; font-size: 11px; width: 100%;">
<option value="">Not Set</option>
<option value="left">Left</option>
<option value="right">Right</option>
<option value="texttop">Texttop</option>
<option value="absmiddle">Absmiddle</option>
<option value="baseline">Baseline</option>
<option value="absbottom">Absbottom</option>
<option value="bottom">Bottom</option>
<option value="middle">Middle</option>
<option value="top">Top</option>
</select>
</td>
</tr>
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Border Thickness:</td>
<td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="borderThickness" id="borderThickness" value="" style="font-size: 10px; width: 100%;"></td>
</tr>
</table>
</td>
<td width="10"> </td>
<td>
<span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Spacing:</span>
<table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Horizontal:</td>
<td style="padding-bottom: 2px; padding-top: 0px;" width="105"><input type="text" name="horizontal" id="horizontal" value="" style="font-size: 10px; width: 100%;"></td>
</tr>
<tr>
<td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Vertical:</td>
<td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="vertical" id="vertical" value="" style="font-size: 10px; width: 100%;"></td>
</tr>
</table>
</td></tr></table>
<div align="right" style="padding-top: 5px;"><input type="submit" value=" Submit " style="font-size: 12px;" > <input type="submit" value=" Cancel " style="font-size: 12px;" onClick="window.close()"></div>
</tr></td></form></table>
<?php
}
?>
</body>
</html>
<?php ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>openWYSIWYG | Select Color</title> </head> <script language="JavaScript" type="text/javascript"> /* ---------------------------------------------------------------------- *\ Function : insertImage() Description : Inserts image into the WYSIWYG. \* ---------------------------------------------------------------------- */ function insertImage(url,alt,align,border,hspace,vspace) { var image = '<img src="' + url + '" alt="' + alt + '" alignment="' + align + '" border="' + border + '" hspace="' + hspace + '" vspace="' + vspace + '"/>'; window.opener.insertHTML(image, 'text1'); window.close(); } </script> <body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"> <?php if ($_SERVER['REQUEST_METHOD'] == "POST") { $alt= $_POST['alt']; $alignment= $_POST['alignment']; $border = $_POST['borderThickness']; $hspace = $_POST['horizontal']; $vspace = $_POST['vertical']; if(!empty($_POST['imageurl'])) { $url = $_POST['imageurl']; ?> <script type="text/javascript"> var uitvoeren = insertImage(' <?php echo $url; ?>',' <?php echo $alt; ?>',' <?php echo $alignment; ?>',' <?php echo $border; ?>',' <?php echo $hspace; ?>',' <?php echo $vspace; ?>'); </script> <?php } elseif(!empty($_FILES['imageurl2'])) { $url = $_FILES['imageurl']; $van = $_FILES['imageurl2']['tmp_name']; $bestand = $_FILES['imageurl2']['name']; $naar = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand; { $url = $_SERVER['SERVER_NAME'].'/images/allerlei/'.$bestand; ?> <script type="text/javascript"> var uitvoeren = insertImage(' <?php echo $url; ?>',' <?php echo $alignment; ?>',' <?php echo $border; ?>',' <?php echo $hspace; ?>',' <?php echo $vspace; ?>'); </script> <?php } else { } } else { ?> <script language="Javascript" type="text/javascript"> window.close(); </script> <?php } } else { ?> <table border="0" cellpadding="0" cellspacing="0" style="padding: 10px;"><form action="<?php $_SERVER['REQUEST_URI']; ?>" method="post" enctype="multipart/form-data"><tr><td> <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Insert Image:</span> <table width="380" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;"> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Image URL:</td> <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="text" name="imageurl" id="imageurl" value="" style="font-size: 10px; width: 100%;"></td> </tr> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Locale afbeelding:</td> <td style="padding-bottom: 2px; padding-top: 0px;" width="300"><input type="file" name="imageurl2" id="imageurl2" style="font-size: 10px; width: 100%;"></td> </tr> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Alternate Text:</td> <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="alt" id="alt" value="" style="font-size: 10px; width: 100%;"></td> </tr> </table> <table width="380" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;"><tr><td> <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Layout:</span> <table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;"> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="100">Alignment:</td> <td style="padding-bottom: 2px; padding-top: 0px;" width="85"> <select name="alignment" id="alignment" style="font-family: arial, verdana, helvetica; font-size: 11px; width: 100%;"> <option value="">Not Set</option> <option value="left">Left</option> <option value="right">Right</option> <option value="texttop">Texttop</option> <option value="absmiddle">Absmiddle</option> <option value="baseline">Baseline</option> <option value="absbottom">Absbottom</option> <option value="bottom">Bottom</option> <option value="middle">Middle</option> <option value="top">Top</option> </select> </td> </tr> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Border Thickness:</td> <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="borderThickness" id="borderThickness" value="" style="font-size: 10px; width: 100%;"></td> </tr> </table> </td> <td width="10"> </td> <td> <span style="font-family: arial, verdana, helvetica; font-size: 11px; font-weight: bold;">Spacing:</span> <table width="185" border="0" cellpadding="0" cellspacing="0" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;"> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;" width="80">Horizontal:</td> <td style="padding-bottom: 2px; padding-top: 0px;" width="105"><input type="text" name="horizontal" id="horizontal" value="" style="font-size: 10px; width: 100%;"></td> </tr> <tr> <td style="padding-bottom: 2px; padding-top: 0px; font-family: arial, verdana, helvetica; font-size: 11px;">Vertical:</td> <td style="padding-bottom: 2px; padding-top: 0px;"><input type="text" name="vertical" id="vertical" value="" style="font-size: 10px; width: 100%;"></td> </tr> </table> </td></tr></table> <div align="right" style="padding-top: 5px;"><input type="submit" value=" Submit " style="font-size: 12px;" > <input type="submit" value=" Cancel " style="font-size: 12px;" onClick="window.close()"></div> </tr></td></form></table> <?php } ?> </body> </html>
allerlei heeft alle rechten en het script heeft al gewerkt... |