vingne
08-15-2005, 01:21 PM
function edInsertImage(myField) {
var myValue = prompt('Enter The Filename of the picture you want to add', 'Filename.jpg');
if (myValue) {
myValue = '<img src=http://localhost/~rr/images/news/'
+ myValue
+ ' />';
edInsertContent(myField, myValue);
}
}
This is the function i use now to insert a image to my textarea. Now the user has to specify the filename manually.
I want the user to be able to choose the picture from a popup window, in stead of the prompt way("manual way")
Here is my code for my planned popup window:
<b>Your Images:</b>
<table class='main'>
<?
$db->Query("SELECT * FROM Pictures
WHERE usr_id='".$_SESSION['usr_id']."'
ORDER BY pic_filename", "pictures");
while ($pictures=mysql_fetch_assoc($db->res['pictures'])) {
echo "<tr>";
echo "<td><img src='/~rr/images/news/" . $pictures['pic_filename'] . "' height='50' width='50'></a></td>";
echo "<td>" . $pictures['pic_filename'] . "</td>";
echo "</tr>";
}
?>
</table>
This is how i want it to be:
1. User click Insert image button
2. User gets the popup window with the list of the pictures(with thumbnails)
3. User click on one picture then it inserts myValue to my function and closes the popup window and insert the html code for the picture.
Anyone able to help me with this? i have googled for hours :/
var myValue = prompt('Enter The Filename of the picture you want to add', 'Filename.jpg');
if (myValue) {
myValue = '<img src=http://localhost/~rr/images/news/'
+ myValue
+ ' />';
edInsertContent(myField, myValue);
}
}
This is the function i use now to insert a image to my textarea. Now the user has to specify the filename manually.
I want the user to be able to choose the picture from a popup window, in stead of the prompt way("manual way")
Here is my code for my planned popup window:
<b>Your Images:</b>
<table class='main'>
<?
$db->Query("SELECT * FROM Pictures
WHERE usr_id='".$_SESSION['usr_id']."'
ORDER BY pic_filename", "pictures");
while ($pictures=mysql_fetch_assoc($db->res['pictures'])) {
echo "<tr>";
echo "<td><img src='/~rr/images/news/" . $pictures['pic_filename'] . "' height='50' width='50'></a></td>";
echo "<td>" . $pictures['pic_filename'] . "</td>";
echo "</tr>";
}
?>
</table>
This is how i want it to be:
1. User click Insert image button
2. User gets the popup window with the list of the pictures(with thumbnails)
3. User click on one picture then it inserts myValue to my function and closes the popup window and insert the html code for the picture.
Anyone able to help me with this? i have googled for hours :/