Compatible with: M1.1 x IPB 2.1.x
Author: visiblesoul
Download: N/A
Demo: N/A
Description:
This little hack will allow IPB 2.1.x users to display image thumbnail attachments in the Board News block. The thumbnail size is determined by the max size that is set in the forum CP.
You will need to use the "Add into Post" attachment feature ( example: [attachment=1:attachment] ) for this to work.
Attached images will be centered in the block.
FIND in /mkportal/include/IPB/ipb_board_functions.php (function get_board_news):
$DB->query("SELECT t.*, p.*, p.icon_id as icona, f.name as forum_name, m.id as member_id, m.name as member_name, a.avatar_location, a.avatar_size, a.avatar_type
FROM ibf_posts p
REPLACE WITH:/*
$DB->query("SELECT t.*, p.*, p.icon_id as icona, f.name as forum_name, m.id as member_id, m.name as member_name, a.avatar_location, a.avatar_size, a.avatar_type
FROM ibf_posts p
*/
// Show attachments
$DB->query("SELECT t.*, p.*, p.icon_id as icona, f.name as forum_name, m.id as member_id, m.name as member_name, a.avatar_location, a.avatar_size, a.avatar_type, at.attach_id, at.attach_thumb_location, at.attach_thumb_width, at.attach_thumb_height, at.attach_is_image, at.attach_pid, at.attach_approved
FROM ibf_attachments at, ibf_posts p
FIND:$testo = str_replace("style_emoticons/<#EMO_DIR#>", "$mkportals->forum_url/style_emoticons/default", $testo);
ADD AFTER: // Show attachments
if ( $post['topic_hasattach'] && $post['attach_is_image'] && $post['attach_approved'] ) {
if ( $post['attach_thumb_location'] AND $post['attach_thumb_width'] ) {
if ( strstr( $testo, '[attachmentid='.$post['attach_id'].']' ) ) {
$testo = str_replace( '[attachmentid='.$post['attach_id'].']', "<div style="text-align:center"><img src="$mklib->siteurl/$mklib->forumpath/uploads/{$post['attach_thumb_location']}" height="{$post['attach_thumb_height']}" width="{$post['attach_thumb_width']}" border="0" alt="" /></div>", $testo );
}
}
}
// end Show Attachments














