SimplePortal

Customization => Custom Coding => Topic started by: Burke Knight on October 25, 2008, 10:04:43 PM

Title: Gallery Block?
Post by: Burke Knight on October 25, 2008, 10:04:43 PM
I am running SMF 2.0 Beta 4. I have SMFGallery installed, and SimplePortal Version Classic 2.0.5 yet there is no block for the Gallery, like on my 1.1.6 forums.

Does anyone have a working random image block that I could get the code for?
Title: Re: Gallery Block?
Post by: ibm450 on October 25, 2008, 10:50:21 PM
this works on my setup - smf 116, gallery lite 193 http://yarriesafety.mine.nu (http://yarriesafety.mine.nu)

create php block in sp and paste, not sure if it will work with media gallery though, try see what happens  :P

Code: [Select]
global $modSettings, $context, $user_info, $scripturl, $sc, $ID_MEMBER, $db_prefix, $txt, $func;

$GD_Installed = function_exists('imagecreate');

$dbresult = db_query("
SELECT p.ID_PICTURE
FROM {$db_prefix}gallery_pic as p
ORDER BY ID_PICTURE DESC
LIMIT 1", __FILE__, __LINE__);

$max = mysql_fetch_assoc($dbresult);
$check = 0;

while($check == 0) {

$idpic = rand(1, $max['ID_PICTURE']);

$dbresult = db_query("
SELECT p.ID_PICTURE, p.commenttotal, p.filesize, p.views, p.thumbfilename, p.filename, p.height, p.width, p.title, p.ID_MEMBER,
m.memberName, m.realName, p.date, p.description
FROM {$db_prefix}gallery_pic as p
LEFT JOIN {$db_prefix}members AS m on ( p.ID_MEMBER = m.ID_MEMBER)
WHERE p.approved = 1 AND p.ID_PICTURE = $idpic
ORDER BY ID_PICTURE DESC", __FILE__, __LINE__);
$gallery_picture = array();
while($row = mysql_fetch_assoc($dbresult))
{

$row['description'] = strip_tags(strtr(parse_bbc($row['description'], 1), array('<br />' => '')));
if ($func['strlen']($row['description']) > 128)
$row['description'] = $func['substr']($row['description'], 0, 60) . '<a href="' . $scripturl . '?action=gallery;sa=view;id=' . $row['ID_PICTURE'] . '">...</a>';

$gallery_picture = array (
'id' => $row['ID_PICTURE'],
'title' => $row['title'],
'desc' => $row['description'],
'views' => $row['views'],
'senderid' => $row['ID_MEMBER'],
'sendername' => $row['realName'],
'thumbfilename' => $row['thumbfilename'],
'filename' => $row['filename']
);
}

mysql_free_result($dbresult);

if(!empty($gallery_picture) || empty($max))
$check = 1;
}

if (!empty($gallery_picture)) {
echo '<div align="center">';
echo '
<a href="' . $scripturl . '?action=gallery;sa=view;id=' . $gallery_picture['id'] . '"><img ' . ($GD_Installed == true ?  'src="gallery/' . $modSettings['gallery_url'] . $gallery_picture['filename'] . '" ' : 'src="' . $modSettings['gallery_url'] . $gallery_picture['filename'] . '" height="90" width="90" ')  . ' border="3" /></a>
<br />' . $gallery_picture['title'] . '<span class="smalltext"><br />
' . $gallery_picture['desc'] . '<br />
<b>' . $txt['sp-grpictureviews'] . '</b> ' . $gallery_picture['views'] . '<br />';

echo '<li><a href="', $scripturl, '?action=register">' , $txt[97] , '</a></li>';

if ($gallery_picture['sendername'] != '')
echo '<b>' . $txt['sp-grpicturesender'] . '</b> <a href="' . $scripturl . '?action=profile;u=' . $gallery_picture['senderid'] . '">'  . $gallery_picture['sendername'] . '</a><br />';
else
echo '<b>' . $txt['sp-grpicturesender'] . '</b> ' . $txt['sp-grpictureguest'] . '<br />';
echo '</span>';



echo '</div>';
         
Title: Re: Gallery Block?
Post by: ccbtimewiz on October 25, 2008, 11:04:55 PM
SMF Gallery is a default block on SP, no?
Title: Re: Gallery Block?
Post by: Burke Knight on October 26, 2008, 01:23:53 AM
Not on the latest, combined with SMF 2.0 Beta 4.
That's what shocked me....LOL
Title: Re: Gallery Block?
Post by: ???1031 on October 28, 2008, 02:15:10 AM
At the moment we released the SMF 2.0 Beta Version of SPortal there was no compatible Version for the SMF Shop, SMF Arcarde and SMF Gallery. So we did no implemented these in the Version. But we will insert it again, if the mods are working in the same way as before. ;)

Bye
DIN1031
Title: Re: Gallery Block?
Post by: Burke Knight on October 28, 2008, 08:53:40 AM
Well, as soon as new block for Gallery is made, I'll be all set on that one site. :)
Title: Re: Gallery Block?
Post by: Simone on November 19, 2008, 05:52:13 AM
Above code doesn't seem to work with SMF Media Gallery 1.5 RC 2
But would love it to. If someone can figure it out would be greatly appreciated  :)

Can look HERE (http://robertson426.com/index.php) . Just scroll down to bottom.
Title: Re: Gallery Block?
Post by: ???1031 on November 19, 2008, 10:15:19 AM
In the new Version there will be a block for the media gallery and the gallery lite :).
Title: Re: Gallery Block?
Post by: swtdivalove on November 23, 2008, 10:59:37 AM
Kind of bummed out about this not working for 2.0.4.  It's one of those things that I kept looking for but couldn't find.  So, I popped over here to see what's up and it's not available on 2.0.4.  :'(

I'd really like to see this as I use it as an attraction on my sites.

Any kind of time frame when it will be added?
Title: Re: Gallery Block?
Post by: Nathaniel on November 23, 2008, 06:06:34 PM
In the next version of SimplePortal.

The release should be soon.

The dev team has not set a specific timeframe/date, and won't be giving a date. This takes pressure off the dev team, meaning that we have the time to properly test and fix all of the bugs that are fixed and the features that are added, before the SimplePortal version is made public.

Title: Re: Gallery Block?
Post by: iain sherriff on December 10, 2008, 04:57:16 AM
Above code doesn't seem to work with SMF Media Gallery 1.5 RC 2
But would love it to. If someone can figure it out would be greatly appreciated  :)

Can look HERE (http://robertson426.com/index.php) . Just scroll down to bottom.

I have SMG 1.5 working in a center block with this code
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, 4, '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: 1px #000000 solid; 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" alt="" /></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>
    </td>';
echo '
  </tr>
</table></center>';
/code]


SMF 1.1.7
SMG 1.5
SP 2.1.1

uklows.com
Title: Re: Gallery Block?
Post by: ibm450 on December 10, 2008, 05:44:25 PM
no probs with media gallery 1.5 here also, changed thumb sizes to 500 x 500 so the random pic display isnt so tiny on home page


yarriesafety.mine.nu

Title: Re: Gallery Block?
Post by: slinouille on December 14, 2008, 02:45:16 AM
Hello all !

My first post here  :holding-flower:

Does anyone has managed to adapt this last code to SMF2b4 ?

I've tried but didn't get it work  :'(

Thx

SliN
Title: Re: Gallery Block?
Post by: iain sherriff on December 14, 2008, 09:49:59 AM
i've just done a test board with
SMF 2.0b4
SMG 1.5
SP 2.1.1

the code works just the same as with 1.1.7 ?
Title: Re: Gallery Block?
Post by: slinouille on December 14, 2008, 11:14:31 AM
Strange ... in the same configuration I've got an empty block

Don't understand why because the code proposed should work  :-X

I've used a PHP block, it's correct ?

----------------
EDIT :

Yep it works ... I've deleted the old one and created a new

Thanks
SimplePortal 2.3.8 © 2008-2024, SimplePortal