vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   [Solved] Image-attachment from another post (https://vborg.vbsupport.ru/showthread.php?t=214326)

Andrewsha 05-22-2009 09:10 PM

[Solved] Image-attachment from another post
 
Hello!

On our forum image-attachment (when quoted) or used in another posts instead of showing as image showed as link "Attachment 422".

You can see:
Сообщение от Yana Посмотреть сообщение
Я вот на какой агрегат наткнулась в Sur La Table
Вложение 422 <<<--- Wanted Image
и такие пельменницы))
Вложение 423 <<<--- Wanted Image

Please give me advice how can I show attachment as image in any posts ?

AFAIK it's needed to customize source code.

Thank you for advance

Andrewsha 05-26-2009 03:22 PM

Corrected original post - not only quoted attachment.
I'm talking about using attachments in any posts.

Andy 05-26-2009 04:28 PM

This hack will show linked attachments as inline images.

You will need to edit the /includes/class_bbcode.php file.

Find this comment:

"Display the attachment with no link to bigger image"

change the variable just below the comment: $attachment['filename'] to $attachmentid

Find this comment:

Belongs to another post so we know nothing about it ...

comment out the two lines of code:

Code:

$addtarget = (empty($this->attachments["$attachmentid"]) OR $attachment['newwindow']) ? 'target="_blank"' : '';
Code:

$replace[] = "<a href=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1" . (!empty($attachment['dateline']) ? "&amp;d=$attachment[dateline]" : "") . "\" $addtarget>$vbphrase[attachment] \\1</a>";

Then add this block of code just bellow the last comment out line:

Code:

$replace[] = "<img src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&amp;d=$attachment[dateline]\" border=\"0\" alt=\""
. construct_phrase($vbphrase['image_x_y_z'], $attachmentid, $attachment['counter'], $attachment['filesize'])
. "\" " . (!empty($align) ? " style=\"float: $align; margin: 2px\"" : 'style="margin: 2px"') . " />";


Andrewsha 05-29-2009 11:41 AM

Andy, thank you very much.
It works!


All times are GMT. The time now is 01:34 PM.

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.02480 seconds
  • Memory Usage 1,716KB
  • 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
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete