Page 1 of 2

Will inline image attachments display on the portal?

Posted: 22. May 2008 14:21
by magnusm
Hi,
I've been looking around for portals for a while now, and there seems to be a problem with inline attachment images displaying on the front pages of the portal when posts from a news forum are displayed on the portal. I was wondering if that is a problem in Board3portal?

tl;dr Will inline image attachments display on the portal news posts?

thanks.

Re: Will inline image attachments display on the portal?

Posted: 22. May 2008 19:30
by Kevin
Not yet.
Maybe we'll implement this feature before the final release, but we'll see.

Re: Will inline image attachments display on the portal?

Posted: 22. May 2008 20:45
by magnusm
Hi,
thanks for the reply. I guess this must be pretty tricky, since no portal can get it working. :|
I'll keep looking, maybe I'll be back again :)

Re: Will inline image attachments display on the portal?

Posted: 10. June 2008 12:28
by hewitt
magnusm wrote:Hi,
thanks for the reply. I guess this must be pretty tricky, since no portal can get it working. :|
I'll keep looking, maybe I'll be back again :)
I was asking for this before and couldn't find any. But hey, now you can do it. Check out this this topic from phpbb. Attached images can be displayed with the news. Or as a gallery too.

Cheers,

Re: Will inline image attachments display on the portal?

Posted: 10. June 2008 12:38
by Kevin
Awesome hewitt!
Many thanks for sharing this! :)

As i had a quick look: it's limited to images?


(Moved topic to: Blocks - In Development)

Re: Will inline image attachments display on the portal?

Posted: 11. June 2008 07:14
by hewitt
Yes, it only displays images. Such as jpg, jpeg, gif, png, bmp. Other types of images can be added on

Re: Will inline image attachments display on the portal?

Posted: 14. July 2008 19:38
by connect
Any progress?

Re: Will inline image attachments display on the portal?

Posted: 5. August 2008 12:03
by connect
I've finally managed to bring up inline attachment functionality, so happy :D

Now I'm going to post this mod here.....

Re: Will inline image attachments display on the portal?

Posted: 5. August 2008 12:27
by connect
Hope this code will bring inline attachments to your portal, guys. ;)

1. OPEN
/portal/includes/functions.php

2. FIND

Code: Select all

$posts[$i]['bbcode_uid'] = $row['bbcode_uid'];
$len_check = $row['post_text'];
3. BEFORE ADD

Code: Select all

// Pull attachment data
$sql2 = 'SELECT *
	FROM ' . ATTACHMENTS_TABLE . '
	WHERE `post_msg_id` = '. $row['post_id'] .'
	AND in_message = 0';
				
$result2 = $db->sql_query($sql2);

while ($row2 = $db->sql_fetchrow($result2))
{
	$attachments[] = $row2;
}
$db->sql_freeresult($result2);
4. FIND

Code: Select all

$message = smiley_text($message); // Always process smilies after parsing bbcodes
5. BEFORE ADD

Code: Select all

if (!empty($attachments))
{
	parse_attachments($row['forum_id'], $message, $attachments, $update_count);
}
Well...that's it. Please correct me if it still wont working. :geek:

Re: Will inline image attachments display on the portal?

Posted: 5. August 2008 12:51
by Kevin
Wow - that's cool, thank you very much for sharing this! :)
I'll test it soon.
Do you have already a demo of the working code?

Re: Will inline image attachments display on the portal?

Posted: 5. August 2008 13:03
by connect
Sorry, but I prefer not to share my portal address. It would not show much anyway. But this code is working for me.

This code is taken from viewtopic.php and adapted for portal view. In other words it just makes portal to treat attachments the forum natural way. The main difference is that viewtopic.php operates with an array of posts instead of one at a time.

You could search through viewtopic.php for "// Pull attachment data"
and "parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count);"

Re: Will inline image attachments display on the portal?

Posted: 10. August 2008 15:08
by Ice
It works, but for some odd reason the attachments are in a reverse order on the portal. :/

Re: Will inline image attachments display on the portal?

Posted: 11. August 2008 07:20
by connect
Try to play around with mysql query from Step 3.

Adding "DESC" directive may fix that problem.

P.S. I have an incremental in ACP attachment order settings.

Re: Will inline image attachments display on the portal?

Posted: 11. August 2008 07:23
by Kevin
Yes, correct. He already added it. ;)
http://board3deportal.svn.sourceforge.n ... athrev=286

Thanks again, connect, to point out this solution! :)

Re: Will inline image attachments display on the portal?

Posted: 11. August 2008 07:28
by connect
Maybe it's better to check that ACP option before mysql request?