View Full Version : [Solved] Image-attachment from another post
Andrewsha
05-22-2009, 09:10 PM
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.
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:
$addtarget = (empty($this->attachments["$attachmentid"]) OR $attachment['newwindow']) ? 'target="_blank"' : '';
$replace[] = "<a href=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1" . (!empty($attachment['dateline']) ? "&d=$attachment[dateline]" : "") . "\" $addtarget>$vbphrase[attachment] \\1</a>";
Then add this block of code just bellow the last comment out line:
$replace[] = "<img src=\"{$this->registry->options['bburl']}/attachment.php?{$this->registry->session->vars['sessionurl']}attachmentid=\\1&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!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.