Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12312
Latest: Delta5
New This Month: 13
New This Week: 1
New Today: 0
Stats
Total Posts: 39664
Total Topics: 6985
Most Online Today: 34
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 30
Total: 30

Author Topic: How to show recent images from gallery on external page?  (Read 14566 times)

0 Members and 1 Guest are viewing this topic.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14854
    • View Profile
Re: How to show recent images from gallery on external page?
« Reply #15 on: March 21, 2014, 08:00:30 am »
Change to
Code: [Select]
<?php require("/home5/jeepthin/public_html/forum/SSI.php"); ?><!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>JeepThing</title>
</head>

<body>
<?php
EzBlockGalleryRandomImage
(array(),0,1);?>

function EzBlockGalleryRandomImage($paramters = array(), $category = 0, $numimages = 1, $startHtml = '', $endHtml = '')
{
global $txt, $db_prefix, $context, $user_info, $modSettings, $scripturl, $boardurl;

$galleryPro = false;
if (!$context['user']['is_guest'])
$groupsdata = implode($user_info['groups'],',');
else
$groupsdata = -1;

if (isset($modSettings['gallery_set_count_child']))
$galleryPro = true;

echo $startHtml;

// Set the category
$category = (int) $category;

$numimages = (int)  $numimages;
$rows = 4;

// Pass all the parematers
foreach($paramters as $myparam)
{
if ($myparam['parameter_name'] == 'category')
$category = (int) $myparam['data'];
if ($myparam['parameter_name'] == 'images')
$numimages = (int) $myparam['data'];
if ($myparam['parameter_name'] == 'rows')
$rows = (int) $myparam['data'];

}

// Check if gallery is installed
if (!isset($modSettings['gallery_max_filesize']))
{
echo $txt['ezp_gallery_block_noinstall'];
}
else
{
if (empty($modSettings['gallery_url']))
$modSettings['gallery_url'] = $boardurl . '/gallery/';

// Load the Gallery language files
if (loadlanguage('Gallery') == false)
loadLanguage('Gallery','english');

$rowlevel = 0;
$maxrowlevel = $rows;

if ($galleryPro == false)
$request = db_query("
SELECT
thumbfilename, ID_PICTURE, filename
FROM {$db_prefix}gallery_pic
WHERE " . ($category == 0 ? '' : ' AND ID_CAT = ' . $category . ' ') . " approved = 1 ORDER BY RAND() LIMIT " . $numimages, __FILE__, __LINE__);
else
$request = db_query("
SELECT
p.thumbfilename, p.ID_PICTURE, p.filename
FROM {$db_prefix}gallery_pic as p
LEFT JOIN {$db_prefix}members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}gallery_usersettings AS s ON (s.ID_MEMBER = m.ID_MEMBER)
LEFT JOIN {$db_prefix}gallery_catperm AS c ON (c.ID_GROUP IN ($groupsdata) AND c.ID_CAT = p.ID_CAT)
WHERE ((s.private =0 || s.private IS NULL ) AND (s.password = '' || s.password IS NULL )  AND p.USER_ID_CAT !=0 AND p.approved =1) || (p.approved =1 AND p.USER_ID_CAT =0 AND (c.view IS NULL || c.view =1))
" . ($category != 0 ? ' AND p.ID_CAT = ' . $category : '' ) . "
GROUP by p.ID_PICTURE ORDER BY RAND() LIMIT " . $numimages, __FILE__, __LINE__);




echo '<table align="center">
';
while($row = mysql_fetch_assoc($request))
{
if ($rowlevel == 0)
echo '<tr>';
echo'<td align="center"><a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img src="',  $modSettings['gallery_url'] . $row['thumbfilename'] ,'" alt="" /></a></td>';

if($rowlevel < ($maxrowlevel-1))
$rowlevel++;
else
{
echo '</tr>';
$rowlevel = 0;
}

}

if($rowlevel !=0)
echo '</tr>';

mysql_free_result($request);
echo '

</table>';
}


echo $endHtml;

}
?>
</body>
</html>
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
2907 Views
Last post April 10, 2007, 09:17:20 pm
by doctoreast
1 Replies
2821 Views
Last post July 08, 2007, 02:08:43 am
by marcbkk
1 Replies
2685 Views
Last post September 25, 2007, 04:26:40 pm
by SMFHacks
3 Replies
3390 Views
Last post March 13, 2008, 09:04:59 pm
by Weathernut
0 Replies
1773 Views
Last post June 03, 2010, 03:04:50 pm
by trifox

+- Recent Topics

Seller View Log.. Can I delete? by SMFHacks
April 22, 2019, 07:54:29 am

Classified Ads Mod by SMFHacks
April 22, 2019, 07:53:57 am

Pretty Urls extras by Oldiesmann
April 18, 2019, 10:50:05 pm

Message Editor Pro - Copy and Paste Question by SMFHacks
April 14, 2019, 09:36:06 am

PERMIT based permissions vs DENY by tfs
April 11, 2019, 06:58:08 pm

Pretty URLs 2.0.15 forum with >115k posts in just under 8k threads by SMFHacks
April 10, 2019, 01:17:37 pm

Is Menu Editor Pro SMF 2.1 compatible? by videoed
April 05, 2019, 01:51:41 pm

Can't See Gallery? by sah62
March 30, 2019, 08:29:48 am

[Mod] SEO Microdata Breadcrumbs by SMFHacks
March 22, 2019, 11:56:00 pm

Resizing by SMFHacks
March 22, 2019, 07:57:53 am

Powered by EzPortal