Recent Topics

1 Feb 03, 2005 13:50    

Hello,

The last window in the dialog where you choose from "add image to post" and "close window" does not have real "value"... i wanted to add a picture to the post and i uploaded it - why ask me if to add it or to close window? :)

How do I make the "upload image window" paste the link in the post and close itself automatically?

Thanks!

Nir

2 Feb 03, 2005 15:49

In admin/b2upload.php

Delete everything from :-
<p><?php echo T_('Here\'s the code to display it:') ?></p>

to
</form>
</p>

And replace it with :-
<script type="text/javascript">
window.setTimeout("autoClose()",5000);
function autoClose(){
targetopener('<?php echo $piece_of_code; ?>');
window.close();
}
</script>

Change the 5000 to the length of delay you want before the window close.

?

*edit* DON'T forget to make a copy of upload.php first ;)

3 Feb 03, 2005 20:43

thanks a lot ?????!

it works great. although for some reason i had to "fix" some code above your javascript to



if ( ereg('image/',$img1_type)) {

$piece_of_code = '<img src="'.$fileupload_url.'/'.$img1_name.'" border="0" alt="'.$imgdesc.'" />';

} else {

	$piece_of_code = '<a href="'.$fileupload_url.'/'.$img1_name.'" title="'.$imgdesc.'" />'.$imgdesc.'</a>'; 

}

so all the < " and > will be in place :)


Form is loading...