collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 64
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • BCNPalomino: lol, that search doe :O
    July 18, 2014, 09:26:27 AM
  • RohailPro23: hi all
    July 18, 2014, 08:09:00 AM
  • samborabora: sorry, thought this was search, lol
    June 29, 2014, 04:45:12 AM
  • samborabora: sp_embed_image
    June 29, 2014, 04:45:01 AM
  • stanyy: Was it merely correcting the mistake made in 2.0.7 or is 2.0.8 actually faster than 2.0.6?
    June 20, 2014, 07:51:21 AM
  • AngelinaBelle: Smf 2.0.8 has been released. -- uses less memory than 2.0.7 [link]
    June 19, 2014, 03:46:47 PM
  • iSamp: [link]
    June 14, 2014, 06:42:38 AM
  • iSamp: SiNaN Plz Help
    June 14, 2014, 06:42:12 AM
  • iSamp: I need Help Plz Help Me I posted a Thing In English Support Plz read it
    June 14, 2014, 06:21:15 AM
  • Cyberkid: hey!
    June 12, 2014, 02:29:42 AM
  • AngelinaBelle: Hello!
    June 03, 2014, 01:06:04 PM
  • kal: also, hello. :)
    June 03, 2014, 08:36:43 AM
  • kal: I haven't been here in a couple months I don't think.
    June 03, 2014, 08:36:35 AM
  • AngelinaBelle: Welcome back, David
    June 02, 2014, 06:18:46 AM
  • David: I've missed this place!
    June 02, 2014, 01:04:01 AM

* Team Blog

* Recent Posts

Re: Members of a membergroup in footer block by Smasher
[Today at 04:19:26 PM]


Happy birthday Block link? by Itchigo
[Today at 09:02:16 AM]


Re: Download System Block by Itchigo
[Yesterday at 09:34:09 PM]


Re: Members of a membergroup in footer block by Itchigo
[Yesterday at 09:11:22 PM]


Re: Making blocks in simple portal blocks by Mulwa
[Yesterday at 02:22:47 PM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Recent Image Attachments  (Read 3867 times)

0 Members and 1 Guest are viewing this topic.

Offline velorooms

  • Jr. Member
  • **
  • Posts: 74
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #20 on: January 05, 2013, 06: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: 73
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #21 on: January 06, 2013, 12: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

  • Support
  • *
  • Posts: 4881
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Recent Image Attachments
« Reply #22 on: January 07, 2013, 03: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: 73
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #23 on: January 07, 2013, 03: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: 74
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #24 on: January 07, 2013, 04: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: 73
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #25 on: January 07, 2013, 04: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: 74
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #26 on: January 07, 2013, 05: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, 05: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: 74
    • Velorooms
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: Recent Image Attachments
« Reply #27 on: January 07, 2013, 05: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, 05: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: 73
  • Gender: Male
    • Fifty Plus Forum
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Recent Image Attachments
« Reply #28 on: January 08, 2013, 12: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

  • Support
  • *
  • Posts: 4881
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Recent Image Attachments
« Reply #29 on: January 14, 2013, 07: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?