MyBB Community Forums

Full Version: PostImage script. Help to upgrade it.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hello!

Well I'm trying to setup an script.

http://www.postimage.org/mod.php for MyBB ofc.

Here is the instructions to set it up. But it doesn't work.


# 
#-----[ COPY ]------------------------------------------ 
# 

copy addform.html to ./addform.html (root of the forum folder)

# 
#-----[ OPEN ]--------------------------------------------- 
# 

./inc/class_templates.php

# 
#-----[ FIND ]--------------------------------------------- 
# around line 99

		if($eslashes)
		{
			$template = str_replace("\\'", "'", $db->escape_string($template));
		}

# 
#-----[ AFTER, ADD ]--------------------------------------------- 
# 

		if($title === 'newthread' or $title === 'newreply')
		{
			$template = str_replace('</textarea>', '</textarea><br />&nbsp;&bull;&nbsp;<span class=\"genmed\"><a href=\"javascript:void(0);\" onclick=\"window.open(\'http://www.postimage.org/index.php?mode=phpbb&lang=spanish&forumurl=\' + escape(document.location.href), \'_imagehost\', \'resizable=yes,width=500,height=400\');return false;\">Add image to post</a></span>', $template);
		}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM

Please I need help to upgrade this. I really need a tool like this to upload photos.

Anyways if is there other plugin or mod to do this suggestions are welcome.

Thanks!
Go to: ACP > templates > Your theme's templates > New Thread Templates > newthread > and find;
{$codebuttons}
and Add the following code just before that;
<br />&nbsp;&bull;&nbsp;<span class="genmed"><a href="javascript:void(0);" onclick="window.open('http://www.postimage.org/index.php?mode=phpbb&lang=spanish&forumurl=' + escape(document.location.href), '_imagehost', 'resizable=yes,width=500,height=400');return false;">Add image to post</a></span>
I can't click there Sad

I see "Add image to post" but I can't click anything.

Thanks!
I tested it on my local forums and its working. If you wish you can PM me your ACP details so I could take a look.

Edit: There might be some &nbsp; in the template after when you Paste that code in template.

My ACP is in Spanish, it's no problem?

Thanks!
Can you please paste your newthread template code here ?
Here it is:

<html>
<head>
<title>{$lang->newthread_in}</title>
{$headerinclude}
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
{$preview}
{$thread_errors}
{$attacherror}
<form action="newthread.php?fid={$fid}&amp;processed=1" method="post" enctype="multipart/form-data" name="input">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->post_new_thread}</strong></td>
</tr>
{$loginbox}
<tr>
<td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<td class="trow2">{$prefixselect}<input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>
</tr>
{$posticons}
<tr>
<td class="trow2" valign="top"><strong>{$lang->your_message}</strong>{$smilieinserter}</td>
<td class="trow2">
<textarea name="message" id="message" rows="20" cols="70" tabindex="2">{$message}</textarea>
{$codebuttons}
<br&nbsp;/>&nbsp;&bull;&nbsp;<span&nbsp;class="genmed"><a&nbsp;href="javascript:void(0);"&nbsp;onclick="window.open('http://www.postimage.org/index.php?mode=phpbb&lang=spanish&forumurl='&nbsp;+&nbsp;escape(document.location.href),&nbsp;'_imagehost',&nbsp;'resizable=yes,width=500,height=400');return&nbsp;false;">Add&nbsp;image&nbsp;to&nbsp;post</a></span> 
{$multiquote_external}
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{$lang->post_options}</strong></td>
<td class="trow1"><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="postoptions[signature]" value="1" tabindex="7"{$postoptionschecked['signature']} /> {$lang->options_sig}</label>
{$disablesmilies}</span></td>
</tr>
{$modoptions}
{$subscriptionmethod}
{$pollbox}
{$captcha}
</table>
{$attachbox}
<br />
<div style="text-align:center"><input type="submit" class="button" name="submit" value="{$lang->post_thread}" tabindex="4" accesskey="s" />  <input type="submit" class="button" name="previewpost" value="{$lang->preview_post}" tabindex="5" />{$savedraftbutton}</div>
<input type="hidden" name="action" value="do_newthread" />
<input type="hidden" name="posthash" value="{$posthash}" />
<input type="hidden" name="attachmentaid" value="" />
<input type="hidden" name="attachmentact" value="" />
<input type="hidden" name="quoted_ids" value="{$quoted_ids}" />
<input type="hidden" name="tid" value="{$tid}" />
{$editdraftpid}
</form>
{$forumrules}
{$footer}
</body>
</html>
Replace the code which I gave to you with this;
Quote:<br />&nbsp;&bull;&nbsp;<span class="genmed"><a href="javascript:void(0);" onclick="window.open('http://www.postimage.org/index.php?mode=phpbb&lang=spanish&forumurl=' + escape(document.location.href), '_imagehost', 'resizable=yes,width=500,height=400');return false;">Add image to post</a></span>
It works! But I see all my photos with low size in the thread. But when I click the photo it pop-up a new window and I see the original size.

Any way to have the good redirection?
By the way. Here is the .html document I uploaded to my server. It was needed. There is located the "add code" to the post.

<html>
<head>
</head>
<body>
<script language="javascript" type="text/javascript">
<!--
function add_code()
{
	var text = unescape(document.location.search.substring(1));
	var area_ignore_name = /username_list|search/i;
	var area_e=opener.document.getElementsByTagName('TEXTAREA');
	for(var i=0;i<area_e.length;i++)
	{
		if(!area_e[i].name.match(area_ignore_name))
		{
			var area=area_e[i];
			break;
		}
	}
	area.value = area.value + text;
	
	opener.focus();
	window.close();
}
add_code();
//-->
</script>
</body>
</html>

Thanks!
Also I need to get the link:

"Hotlink for Forums (1)"

http://postimage.org/image/e0uts1qc/23f0dcd6/
Please I need help Sad