TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 790
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 422
  • Total: 422

Latest Profile Photos

Started by wilsy, November 29, 2007, 08:27:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Angelotus

Is this thread still active or do I have to go somewhere else with my question?

IchBin

If your question is about this code, then you can ask. If its a different question, you need to start a topic in the appropriate board.

Angelotus

It is a question about this code.
I see it has moved to the previous page, so I will ask again :)

How can I add a block that shows the last 5 uploaded pics from the logged in user. So if ´Steve´ logges in he sees his 5 latest uploaded profile pics.

I hope someone can help me out with this, thanks in advance!

Dragooon

Try
global $db_prefix, $modSettings, $scripturl, $ID_MEMBER;

// Settings
$member_gender = 'female'; // male or female
$num_pictures = 99; // x of thumbnails to display
$order_by = 'latest'; // random or latest


$gender = ($member_gender == 'male') ? '1' : '2';
$order = ($order_by == 'random') ? 'RAND()' : 'p.time DESC';

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE
p.ID_MEMBER = m.ID_MEMBER AND
m.gender = ' . $gender . '
               AND m.ID_MEMBER = '.$ID_MEMBER.'
ORDER BY ' . $order . '
LIMIT ' . $num_pictures, __FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

echo '
<DIV ALIGN="CENTER">
<table width="90%">
<tr>';
foreach ($data as $picture)
{
echo '
<a href="', $picture['url'] ,'"><img src="' . $picture['thumb'] . '" alt="" width="65" height="65" /></a>
';

}
echo '
</tr>
</table></div>';

Angelotus

Dragoon Thanks! I did a little bit of tweaking to the code so it is gender independable:

global $db_prefix, $modSettings, $scripturl, $ID_MEMBER;

// Settings
$order_by = 'latest'; // random or latest


$gender = ($member_gender == 'male') ? '1' : '2';
$order = ($order_by == 'random') ? 'RAND()' : 'p.time DESC';

$sql = db_query ('SELECT p.ID_PICTURE, p.ID_MEMBER, p.title, p.time, p.filename, m.realName
FROM ' . $db_prefix . 'profile_pictures AS p, ' . $db_prefix . 'members AS m
WHERE
p.ID_MEMBER = m.ID_MEMBER
               AND m.ID_MEMBER = '.$ID_MEMBER.'
ORDER BY ' . $order . '
LIMIT 5',__FILE__, __LINE__);


$data = array();
while ($row = mysql_fetch_assoc ($sql)) {
$data[] = array (
'title' => $row['title'],
'thumb' => $modSettings['profile_pictures_url'] . '/' . $row['ID_MEMBER'] . '_' . $row['time'] . '_thumb.' . substr (strrchr ($row['filename'], '.'), 1),
'url' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . ';sa=pictures;view=' . $row['ID_PICTURE'],
'time' => timeformat ($row['time']),
'user' => $row['realName'],
'profile' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
);
}

echo '

<table class="collapse">
<tr>';
foreach ($data as $picture)
{
echo '
<td><a href="', $picture['url'] ,'"><img src="http://kv.nessekrekers.nl' . $picture['thumb'] . '" alt="" class="transOFF" onmouseover="this.className=\'transON\'" onmouseout="this.className=\'transOFF\'" /></a></td>
';

}
echo '
</tr>
</table>';


Thanks for helping!

Angelotus

Hi, is there a way to add a code to count the total amount of profile pictures in the logged in users album?
So I mean something like this:

[pict 1] [pict 2] [pict 3] [pict 4] [pict 5]
You have a total amount of x pics in your album.


timothy082003

Could this code be modified to only show pictures from profiles that allow non-buddies to see their pictures??

Angelotus

Quote from: Angelotus on June 17, 2008, 10:31:47 AM
Hi, is there a way to add a code to count the total amount of profile pictures in the logged in users album?
So I mean something like this:

[pict 1] [pict 2] [pict 3] [pict 4] [pict 5]
You have a total amount of x pics in your album.



Worth a bump. Is this possible?

This website is proudly hosted on Crocweb Cloud Website Hosting.