collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 376
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: Recent Image Attachments  (Read 10033 times)

0 Members and 1 Guest are viewing this topic.

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #20 on: January 05, 2013, 07:58:54 PM »
Here is the code from my sources/portalblocks.php

from the start of attachment image, to the start of the next block.

Code: [Select]
function sp_attachmentImage($parameters, $id, $return_parameters = false)
{
global $boarddir, $txt, $color_profile;

$block_parameters = array(
'limit' => 'int',
'direction' => 'select',
'disablePoster' => 'check',
'disableDownloads' => 'check',
'disableLink' => 'check',
);

if ($return_parameters)
return $block_parameters;

$limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit'];
$direction = empty($parameters['direction']) ? 0 : 1;
$type = array('jpg', 'png', 'gif', 'bmp');
$showPoster = empty($parameters['disablePoster']);
$showDownloads = empty($parameters['disableDownloads']);
$showLink = empty($parameters['disableLink']);

$items = ssi_recentAttachments($limit, $type, 'array');

if (empty($items))
{
echo '
', $txt['error_sp_no_attachments_found'];
return;
}

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['member']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['member']['id']]['link']))
$items[$k]['member']['link'] = $color_profile[$p['member']['id']]['link'];
}
}

echo '
<table class="sp_auto_align">', $direction ? '
<tr>' : '';

foreach ($items as $item)
{
  echo !$direction ? '
<tr>' : '', '
<td>
<div class="sp_image smalltext">', ($showLink ? '
<a href="' . $item['file']['href'] . '">' . $item['file']['filename'] . '</a><br />' : ''), '
<a href="' . $item['topic']['href'] . '">', $item['file']['image']['thumb'], '</a> <br />', ($showDownloads ? '
' . $txt['downloads'] . ': ' . $item['file']['downloads'] . '<br />' : ''), ($showPoster ? '
' . $txt['posted_by'] . ': ' . $item['member']['link'] : ''), '
</div>
</td>', !$direction ? '
</tr>' : '';
}

echo $direction ? '
</tr>' : '', '
</table>';
}

function sp_attachmentRecent($parameters, $id, $return_parameters = false)

Havnt looked in depth at what we changed, but that does exactly what it should, if you click on the image you are taken to the post in question.

You can view it live on the myhomepage.
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline Chas

  • Jr. Member
  • **
  • Posts: 74
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #21 on: January 06, 2013, 01:44:55 AM »
I am not quite certain why this failed, and have not had time to test.
Have you looked at the HTML for that page to see where it has gone wrong?

Perhaps it would be best to abandon that supplied subroutine, and go back to the general idea
Code: (find in portalblocks.php) [Select]
$item['file']['image']['link']
Code: (replace in portalblocks.php) [Select]
'<a href="',  $item['topic']['href'],  '"><img src="', $item['file']['image']['thumb'],  '"></a>'

It seems to me this should still work, even if there are errors in the subroutine I supplied.

My apologies for supplying bad code.
This removes the images from the block and replaces them with links to the topic, is that what you intended?

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Recent Image Attachments
« Reply #22 on: January 07, 2013, 04:46:16 PM »
$item['file']['image']['thumb'] is the image that is shown.
Indeed, the link is to the topic.

That was the request from the OP -- to show the image, but link to the topic.

What would you like to show, and link to?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?

Offline Chas

  • Jr. Member
  • **
  • Posts: 74
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #23 on: January 07, 2013, 04:49:51 PM »
$item['file']['image']['thumb'] is the image that is shown.
Indeed, the link is to the topic.

That was the request from the OP -- to show the image, but link to the topic.

What would you like to show, and link to?
As the purpose of the module is to show the image I would like it to remain so but the image to be linked to the topic.
Thanks.

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #24 on: January 07, 2013, 05:19:14 PM »
I posted my code two posts up. If look on my portal and click the recent images pictures (left hand side down a bit), they do exactly that, take you to the post in question.

And im using the code i posted. (unless there is more code i have changed somewhere else :S)
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline Chas

  • Jr. Member
  • **
  • Posts: 74
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #25 on: January 07, 2013, 05:23:37 PM »
Thanks Velorooms, I had tried your code and just got white pages.

Any chance you can post your portalblocks.php file so I can do a side by side comparison? Or even just use yours?

Thanks.

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #26 on: January 07, 2013, 06:07:38 PM »
mine are attached for both 2.3.4 and 2.3.5

worth noting i have made some other adjustments to portal blocks to change a  few things. If you need to view differences try using examdiff which is a really good text file comparer.

I am wondering if i made a change somewhere other than in portalblocks.php I know it took me a while to figure it out. I really need to keep records. :S

DONT use my php file though. its heavily modified, for instance i have png post icons rather than gifs, theres a fair few non standard bits in there. Will mess things up. Ive isolated the line in the post below.
« Last Edit: January 07, 2013, 06:22:23 PM by velorooms »
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline velorooms

  • Jr. Member
  • **
  • Posts: 83
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #27 on: January 07, 2013, 06:15:12 PM »
Just looking through myself.

2.3.5 Portalblocks.php has this line

Code: [Select]
<a href="' . $item['file']['href'] . '">' . $item['file']['filename'] . '</a><br />' : ''), '
', $item['file']['image']['link'], '<br />', ($showDownloads ? '


I have

Code: [Select]
<a href="' . $item['file']['href'] . '">' . $item['file']['filename'] . '</a><br />' : ''), '
<a href="' . $item['topic']['href'] . '">', $item['file']['image']['thumb'], '</a> <br />', ($showDownloads ? '

what i appear to have done is surround the image thumb with a href linking to the topic

<a href="' . $item['topic']['href'] . '" 

Before the second line of code

and </a>  before the <br>

basically surrounded the thumbnail by a href.. i just need to work out if i specified 'topic' elsewhere in the file.
« Last Edit: January 07, 2013, 06:23:53 PM by velorooms »
Admin and Owner of Velorooms.com - Using SMF 2.0.3 and Simpleportal 2.3.5

Offline Chas

  • Jr. Member
  • **
  • Posts: 74
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #28 on: January 08, 2013, 01:13:31 AM »
Just looking through myself.

2.3.5 Portalblocks.php has this line

Code: [Select]
<a href="' . $item['file']['href'] . '">' . $item['file']['filename'] . '</a><br />' : ''), '
', $item['file']['image']['link'], '<br />', ($showDownloads ? '


I have

Code: [Select]
<a href="' . $item['file']['href'] . '">' . $item['file']['filename'] . '</a><br />' : ''), '
<a href="' . $item['topic']['href'] . '">', $item['file']['image']['thumb'], '</a> <br />', ($showDownloads ? '

what i appear to have done is surround the image thumb with a href linking to the topic

<a href="' . $item['topic']['href'] . '" 

Before the second line of code

and </a>  before the <br>

basically surrounded the thumbnail by a href.. i just need to work out if i specified 'topic' elsewhere in the file.
Yes, that did the trick and was all that was needed to make the images in the block linked to the topic, exactly what I needed. many thanks.
Regards
Chas.

Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Recent Image Attachments
« Reply #29 on: January 14, 2013, 08:20:22 PM »
Congratulations, you two! Chas, I'm glad you got it exactly the way you wanted it.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?