Razon Member |
# Posted: 1 Jul 2009 01:19 - Edited by: Razon
With this "idea" of a modification, you could upload pictures!
First of all, you have to create a file called "upload.php" (just theoretical):
<html>
<head>
<title>Bild hochladen</title>
</head>
<?
if($_POST["submit"])
{
$dir = "yourdirectory/"; //directory your images should be uploaded to
$datei = $_FILES['upload']['tmp_name'];
$dateiname = $_FILES['upload']['name'];
$dateitype = $_FILES['upload']['type'];
switch($dateitype)
{
case "image/gif":
$types = ".gif";
break;
case "image/pjpeg":
$types = ".jpg";
break;
case "image/jpeg":
$types = ".jpg";
break;
case "image/x-png":
$types = ".png";
break;
default:
$types = false;
}
if (!file_exists($dir.$dateiname) && $types != false)
{
copy($datei,$dir.$dateiname);
echo '<script language="JavaScript">window.opener.insertHTML("<i mg src='.$dir.$dateiname.'>", "YOURFIELDID");self.close();</script>'; //DONT FORGET TO REPLACE "YOURFIELDID" with the id of your textfield!
}
else
{
echo "Die Datei ist bereits vorhanden oder es handelt sich nicht um eine Bilddatei!"; //Errormessage
}
}
else
{
echo '<form method="POST" enctype="multipart/form-data" action="upload.php"><p><input type="file" name="upload" size="20"></p><p><input type="submit" name="submit" value="Bild hochladen"></p></form>';
}
?>
</body>
</html>
DONT FORGET TO REPLACE "YOURFIELDID" with the id of your textfield and the directory your images should be uploaded to!
Then you have to edit "wyzz.js" (just theoretical):
Just should search for "function insertImage(n)" and replace the whole function with the following code (the function should begin with { and end with the next }):
function insertImage(n) {
window.open("upload.php","hochladen","width=400, height=100");
}
After uploading "wyzz.js" and "upload.php" to your server, you could enjoy the new function ;)
btw... the images should be directly inserted into the editor!
|