News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[TIP/TRICK] Tinypic Image Upload Popup on Post/Reply Page

Started by brandonroy, January 24, 2009, 11:20:16 PM

Previous topic - Next topic

gbsothere

Sure, and thanks!

In 1.1.10, the Upload button is placed just to the right of the BBC buttons and just above the smilies:




But in 2.x, it's located above the subject line.  I can live with it, but others may prefer it to be similar to 1.1.10.  Try as I might, I can't seem to land it there. 





My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

Tyrsson

Ok, if you will post all the edits you are using then I can try to test it out and see if can come up with a fix. I know some of the edits may already be in this topic but I have a lot going on today and it will be easier to answer your question if I get the exact edits you have made for this (including any mods you may have installed along with this to add this to the forum).
PM at your own risk, some I answer, if they are interesting, some I ignore.

gbsothere

Thanks for checking it out, Tyrsson and absolutely no hurry, at all.   :)

In RC1.2, Themes/Post.template.php I found:

{
echo '
<tr>
<td align="right"></td>
<td valign="middle">
', template_control_richedit($context['post_box_name'], 'bbc'), '
</td>
</tr>';



And added AFTER:

echo '&nbsp;&nbsp;<a onclick="window.open(\'URL FOR YOUR TINYPIC HTML FILE HERE\',\'POPUP\',\'width=280,height=540,scrollbars=0\');return false;" href="#"><img src="URL FOR THE IMAGE BUTTON HERE" border="0"></a>';

(I placed my own url for the tinypic.html file and the image in this code.)

On the first page/post of this thread, there is also the tinypic.html file to place in the forum's root and the uploadimage.gif to put in Themes/(theme)/images.  (I use default). 

Most of these mods were added after this TinyPic Tip but none of them use the Post.template.php.

My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

bombasa

First of all i would like to thank the author of this trick ;) and gbsothere for porting it to smf 2.0

I think i did fix it on smf 2.0 RC1.2 :

In Post.template.php :

Find :

{
echo '
<tr>
<td align="right"></td>
<td valign="middle">
', template_control_richedit($context['post_box_name'], 'bbc'), '
</td>
</tr>';
}


And add after :

{
echo '
<tr>
<td align="right"></td>
<td valign="middle">
<a onclick="window.open(\'URL OF TINYPIC.HTML\',\'POPUP\',\'width=280,height=540,scrollbars=0\');return false;" href="#"><img src="URL OF THE GIF HERE" border="0"></a></td>
</tr>';
}



gbsothere

bombasa, it works beautifully and thanks so much for posting it.

:)


(Note for new viewers:  Bombasa's code is for 2.0.  The code for 1.x is found on the first post but the code alone isn't enough, you must download the attached tinypic.html file and uploadimage.gif.)
My apologies, but I am taking a break from accepting PM requests for support.  If I am not currently assisting you, please do not ask as long as this notice is posted.  Thank you.

I Don't Want To Grow Old Alone


It has been proven that Steely Dan reduces the occurrence of road rage, according to an independent study.



A reminder about admin / ftp passwords etc.

DaBoss48

I added this like bombasa showed but only his is for 2.0 RC1.2 and I am on RC2. It works on RC2 only problem is that the button is placed right next to the Post and Preview buttons. I am wondering if somebody can fix it so the button can be right next to the smileys again? Thank You!


DaBoss48

Does anybody know how to make this work for 2.0 RC2? Please if you do then please tell us  :)

bombasa

Finally !!! I did it !

I managed to get it working with the help of this awsome MOD

Well to apply the hack on 2.0 RC2, you should do the following :

Find : /Themes/default/GenericControls.template.php

Find :

<textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" rows="', $editor_context['rows'], '" cols="', $editor_context['columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="', $context['browser']['is_ie8'] ? 'max-width: ' . $editor_context['width'] . '; min-width: ' . $editor_context['width'] : 'width: ' . $editor_context['width'], '; height: ', $editor_context['height'], ';', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '">', $editor_context['value'], '</textarea>

Add after :

<div>
<a onclick="window.open(\'url of html file\',\'POPUP\',\'width=280,height=540,scrollbars=0\');return false;" href="#"><img src="url of img file" border="0">
</div>


It should work

Edit : the new code position should prevent the popup window from being accessed while you click on the text area.

Joker™

Quote from: bombasa on November 30, 2009, 11:05:10 AM
Finally !!! I did it !

I managed to get it working with the help of this awsome MOD

Well to apply the hack on 2.0 RC2, you should do the following :

Find : /Themes/default/GenericControls.template.php

Find :

<textarea class="editor" name="', $editor_id, '" id="', $editor_id, '" rows="', $editor_context['rows'], '" cols="', $editor_context['columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '" style="', $context['browser']['is_ie8'] ? 'max-width: ' . $editor_context['width'] . '; min-width: ' . $editor_context['width'] : 'width: ' . $editor_context['width'], '; height: ', $editor_context['height'], ';', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? 'border: 1px solid red;' : '', '">', $editor_context['value'], '</textarea>

Add after :

<div>
<a onclick="window.open(\'url of html file\',\'POPUP\',\'width=280,height=540,scrollbars=0\');return false;" href="#"><img src="url of img file" border="0">
</div>


It should work

Edit : the new code position should prevent the popup window from being accessed while you click on the text area.


bro can u tell where will the button will appear to upload pics ?
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

bombasa

It should be like that



This is still a temporary fix, if anyone has a better one, he can post it there.

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

bombasa

You should upload the uploadimage.gif and tinypic.html from the first post : http://www.simplemachines.org/community/index.php?topic=288169.msg1894568#msg1894568 to your host then change the "url of html file" and "url of img file" with the current address of these files.

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Joker™

i just found a bug ...... after implementing this site is unable to send pm's to users ...

plz see the pic below


Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Joker™

Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Joker™

Quote from: sid2varun on December 07, 2009, 01:49:57 AM
i just found a bug ...... after implementing this site is unable to send pm's to users ...

plz see the pic below





hasn't anyone faced the prob as i have faced ???
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Mayhem30

Is it possible to modify the code so we can control what "resize" options are available to the users?


Joker™

Made it working at last  ;D

open

/themes/default/post.template.php

Find:

// Finally, the submit buttons.


Add Before:

echo '<div>
      <a onclick="window.open(\'url of html file\',\'POPUP\',\'width=280,height=540,scrollbars=0\');return false;" href="#"><img

src="url of img file" border="0"></a>
</div>';


http://www.simplemachines.org/community/index.php?topic=288169.msg1894568#msg1894568 << get images from 1st post

i've tested on RC2 Default curve theme n its working absolutely fine ....

i check Private message problem also n it's also vanished ;)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Advertisement: