vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Attached images elsewhere within the post (https://vborg.vbsupport.ru/showthread.php?t=40904)

Admin 07-09-2002 10:00 PM

Attached images elsewhere within the post
 
This is a very basic hack but pretty cool I think...
Anyway, it lets you place your attachments elsewhere in the post, i.e not at the bottom.
All you need to do is place [attachment] where you want it to show up, and voila. :)

Of course this mainly makes sense if you have view images turned on for attachments, so attached images show up inline.
It will also look best if you edit the "postbit_attachmentimage" template and remove the whole "$post[username] has attached this image:" part.

Anyway, installation is really easy, just one file edit. In functions.php, add this code:
Code:

        $attachpos = strpos($post['message'], '[attachment]');
        if ($attachpos !== false) {
                $post['message'] = substr($post['message'], 0, $attachpos) . $post['attachment'] . substr($post['message'], $attachpos + strlen('[attachment]'));
                $post['attachment'] = '';
        }

Right before this:
Code:

        //highlight words for search engine
        if (isset($highlight) && $highlight != '') {

A screen shot is attached...

VeRT3X 07-10-2002 07:29 PM

perfect, thanks alot Chen = ]

Itworx4me 07-10-2002 07:41 PM

Squirrel Mall
Webmall for nuts
:p

Vivi Ornitier 07-10-2002 09:00 PM

gangsta hack man.

Floris 07-10-2002 09:07 PM

great hack, and so easy!

ehjay 07-11-2002 12:02 AM

so Chen, are your test posts always full of "assdas"? ;)

plcguru 07-11-2002 03:20 AM

Hi,
Didn't seem to work for me :disappointed:
I have 2.23 and found the code in fuctions.php
Added the recommended code after it.

posted a test post
like:

some text here.
[attachment]
some text below

attached a gif.

The post looked like:

some text here.
[attachment]
some text below

image down here as usual


Does it work with 2.2.3 and I've done something wrong? (of course, images are turned on as I see the image in the normal place below the text)
I really want to install this as it's a great feature to have.
Thanks!
Phil

Neo 07-11-2002 04:33 AM

Nice Chen.

RDX1 07-11-2002 04:59 AM

what if you use the muti attach hack? one of my boards i run uses it - friend made it though..

Admin 07-11-2002 06:14 AM

plcguru: You might be running a very old version of PHP.

Try replacing this:
Code:

        if ($attachpos !== false) {
With this:
Code:

        if (is_integer($attachpos)) {


All times are GMT. The time now is 01:41 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00969 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete