collapse

* User Info

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

* Who's Online

  • Dot Guests: 77
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • AngelinaBelle: For Documentation navigation, I really like to use the "<<" icon to turn that menu into a "navigation left panel", because I can read it better that way.
    April 21, 2014, 04:12:13 PM
  • oNLy1: Nakroma, please use the forum for support - ask all the questions (dumb or not) they will get answered
    April 18, 2014, 08:03:49 PM
  • Nakroma: i know this is just another question but im too dumb for it, where can I actualy get into the GENERAL SETTINGS page? im dumb sorry ;-;
    April 18, 2014, 04:27:39 PM
  • Nakroma: ahh okey, i get it. thanks
    April 18, 2014, 04:16:18 PM
  • [SiNaN]: Please don't get me wrong; I didn't mean that. You need to use the navigation menu right above the yellow Documentation bar you describe to navigate through different sections of documentation.
    April 18, 2014, 04:12:37 PM
  • Nakroma: okey I am dumb, could someone point out where at the top of the site it is? with a screenshot or something? if you mean the yellow Documention bar, thats not clickable for  me :|
    April 18, 2014, 03:57:34 PM
  • [SiNaN]: I wouldn't say it's hidden, lol. And it's extensive enough, thanks to Angelina.
    April 18, 2014, 02:28:55 PM
  • oNLy1: Documentation [link] (hidden at top of site)
    April 18, 2014, 12:48:01 PM
  • Nakroma: am I dumb or is there actually no tutorial? [link]
    April 18, 2014, 08:29:41 AM
  • AngelinaBelle: Welcome Gusto Prod.  Please visit [link] for info on creating an SMF forum
    April 17, 2014, 12:04:00 PM
  • GUSTO PROD: hi all give me creat new forum free
    April 16, 2014, 12:21:54 PM
  • AngelinaBelle: Hello w1ck3d! Welcome to Simple Portal. Unfortunately, there are not Russian speakers here very often.  Aplogies
    April 14, 2014, 07:49:26 AM
  • w1ck3d: тест
    April 14, 2014, 02:50:12 AM
  • Underdog: How to use Simple Portal for SMF: [link]
    April 02, 2014, 07:52:45 PM
  • Underdog: Thariq, please post questions in the forum. thank you.
    April 02, 2014, 07:51:40 PM
  • Thariq: how to create portal/site
    April 02, 2014, 06:30:42 AM
  • Ali çelen: forum nasıl oluştırıcam
    March 30, 2014, 10:59:08 PM
  • Ali çelen: sa
    March 30, 2014, 10:58:54 PM
  • AngelinaBelle: processor -- I think your customization will probably be just fine.
    February 14, 2014, 07:18:41 PM
  • AngelinaBelle: noumankhan: Welcome to SimplePortal.  Please read the documentation above. If you have questions about how to make a forum, please seek help at [link]
    February 14, 2014, 07:16:45 PM

* Team Blog

* Recent Posts

Re: SimplePortal article by Shayco
[Today at 07:27:22 AM]


Re: Cannot send PM's by mainusz
[Today at 01:33:13 AM]


Re: Youtube Block - 1.0 by USFA
[Today at 12:38:51 AM]


Re: Youtube Block - 1.0 by USFA
[Today at 12:20:58 AM]


Re: Youtube Block - 1.0 by cy8erpunk
[Yesterday at 06:24:00 PM]

Welcome to SimplePortal.net! You can download SimplePortal from the Download Page!

Author Topic: Recent Image Attachments  (Read 3606 times)

0 Members and 1 Guest are viewing this topic.

Offline velorooms

  • Jr. Member
  • **
  • Posts: 71
    • 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: 4716
  • 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: 71
    • 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: 71
    • 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: 71
    • 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: 4716
  • 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?