Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

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

November 30, 2022, 05:24:26 PM

Login with username, password and session length
Members
  • Total Members: 3853
  • Latest: tty456
Stats
  • Total Posts: 193625
  • Total Topics: 21107
  • Online today: 70
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 1
Guests: 37
Total: 38

Author Topic: [Block] SMF Media Gallery Random Picture  (Read 28705 times)

0 Members and 1 Guest are viewing this topic.

Dark-Wolf

  • Guest
Re: [Block] SMF Media Gallery Random Picture
« Reply #40 on: May 27, 2009, 03:18:33 AM »
SMF-Media block code is more clean :)
Instead to use <center> (deprecated and old tag) i've used:
<table style="margin: 0 auto; border: 0;">  ;)

Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: [Block] SMF Media Gallery Random Picture
« Reply #41 on: May 27, 2009, 03:20:39 AM »
Yes you can exclude everything if you like.
Look in the top of the code, you have the diffrent settings right there.

Dark-Wolf

  • Guest
Re: [Block] SMF Media Gallery Random Picture
« Reply #42 on: May 27, 2009, 03:27:30 AM »
Yes you can exclude everything if you like.
Look in the top of the code, you have the diffrent settings right there.
My final code is this (only one random image without table):
Code: [Select]
global $sourcedir, $context, $txt, $galurl, $scripturl, $settings;

require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();

if (loadlanguage('MGallery') == false)
  loadLanguage('MGallery', 'english');

$items = getMediaItems(0, 1, 'RAND()');

foreach ($items as $item)
  echo '
      <div class="smalltext" style="text-align: center; line-height: 1.4em; border: 0; padding: 5px;">
      <a href="',$galurl,'sa=item;id=',$item['id'],'">',$item['title'],'</a><br />
      <a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" /></a><br />
      ',$txt['mgallery_views'],': ',$item['views'],'<br />
      ',$txt['mgallery_posted_by'],': <a href="',$scripturl,'?action=profile;u=',$item['poster_id'],'">',$item['poster_name'],'</a><br />
      ',$txt['mgallery_in_album'],': <a href="',$galurl,'sa=album;id=',$item['id_album'],'">',$item['album_name'],'</a>
      ',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
      </div>';
:)

---
One new question: "Can i exclude a specific gallery(ID) to the block"?
« Last Edit: May 27, 2009, 09:40:22 AM by Dark-Wolf »

jpacs29

  • Guest
Re: [Block] SMF Media Gallery Random Picture
« Reply #43 on: September 04, 2009, 11:10:12 PM »
// Hi Guys, try this code it will show 5 images without border and thumbnail info on your TP block.... hope you like it :D
______________________________________________________________________
Code: [Select]

global $sourcedir, $context, $txt, $galurl, $scripturl, $settings;

require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();

if (loadlanguage('MGallery') == false)
  loadLanguage('MGallery', 'english');

$items = getMediaItems(0, 5, 'rand()');

echo '
<center><table border="0">
  <tr>';

foreach ($items as $item)
  echo '
    <td>
   <div class="smalltext" style="text-align: center; line-height: 1.4em; border: 0px #000000 solid; padding: 5px;">
      <a href="',$galurl,'sa=item;id=',$item['id'],'"></a><br />
      <a href="',$galurl,'sa=item;id=',$item['id'],'"><img alt="" src="',$galurl,'sa=media;id=',$item['id'],';thumb" alt="" /></a><br />

      ',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
      </div>
    </td>';
echo '
  </tr>
</table></center>';

_________________________________________________________________
« Last Edit: September 04, 2009, 11:17:01 PM by jpacs29 »

Offline Freddy

  • Moderator
  • *
  • Posts: 1617
    • AiDreams
Re: [Block] SMF Media Gallery Random Picture
« Reply #44 on: September 05, 2009, 06:42:44 AM »
Cool :)   I Didn't know about the getMediaItems function, thanks jpacs.

I'll have to take a better look at mgallery I think...

jpacs29

  • Guest
Re: [Block] SMF Media Gallery Random Picture
« Reply #45 on: September 05, 2009, 07:28:54 AM »
Cool :)   I Didn't know about the getMediaItems function, thanks jpacs.

I'll have to take a better look at mgallery I think...

Welcome freddy...  i was just lucky that when i tweak that codes, i have no problem during the testing but then i had to do trial and error method too :D