MyBB Community Forums

Full Version: ezGallery latest images on index page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I have one forum running with myBB 1.6, I have installed ezGallery and it's work fine.
My forum: http://www.venetofotoclub.altervista.org.../index.php
my gallery: http://www.venetofotoclub.altervista.org...allery.php

I wish to have the latest 5 images in the index page of the forum, it is possible to make this? I think it is possible making a query and a table but I do not how.

Thanks to everyone who will help meSmile

PS I'm sorry for my bad English!
it would be nice!
This is actually quite simple try this:

Download and install the following plugin:
http://mybbhacks.zingaburga.com/showthread.php?tid=260

After you have installed the plugin create a new PHP file in your forum root with the following code.

<?php
define("IN_MYBB", 1);

//things you are can Edit//


require_once "./global.php";   
//path to your global.php file 

//number of images to use in the slideshow
 $sLim = 10;

//url to your site and the gallery folder of Ezgallery
 $siteURL = '(your URL to the gallery)/gallery/'   
//example 'http://siteurl.com/gallery/'

//DONT EDIT ANY PHP code BELOW unless you know what you are doing//

?>
<html>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($)
{
$(document).ready(function(){
	$('#myslides').cycle({
		fx:    'fade',  
    		speed:    2500
	});
});
}); 
</script>
<style type="text/css">
#myslides {
	width: 340px;
	float: left;
	padding: 0;
	margin:  0 auto;
	margin-top: 20px;
	text-align: center;
} 
</style>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Slide show gallery</title>
</head>

<body>
<div id="myslides">
<?php 
$DbResult = $db->query("SELECT * FROM ".TABLE_PREFIX."gallery_pic ORDER BY ID_PICTURE DESC LIMIT $sLim");

while($dbRows = $db->fetch_array($DbResult)) 
	{ 
	$iPath = $siteURL.$dbRows["filename"]; 
	echo "<img src=".$iPath." style='max-height:280px;max-width:300px;'>";
	} 
?> 
</div>
</body> 
</html>

Now go to your ACP > index page templates > index
And add where you wish.

<?php
include 'galleryslideshow.php';
?>

And that should work atleast it does for me Smile

Edit fixed giant mistake sorry :p
Hello,

I have had a go at this but it dosen't seem to display correctly, i have removed the rotating images script as i just want to display the latest images in a row on the top of my forum but for some reason it dosen't look right.

Can anyone help? http://cl.ly/K6JZ I am trying to get some space around the images and attempt to make it display nicer

Richad
I dont know what code exactly you use but a thing you could try is:

quick way

change style=:
echo "<img src=".$iPath." style='max-height:280px;max-width:300px;'>";

To something you wish like:

echo "<img src=".$iPath." style='
max-height:280px;
max-width:300px; 
margin:5px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
border:2px solid #000000;
-webkit-box-shadow: #8F8F8F 5px 5px 5px;
-moz-box-shadow: #8F8F8F 5px 5px 5px; 
box-shadow: #8F8F8F 5px 5px 5px;
'>";

Nicer looking way

Add below:
<style type="text/css">
#myslides {
    width: 340px;
    float: left;
    padding: 0;
    margin:  0 auto;
    margin-top: 20px;
    text-align: center;
} 

This:

.galleryImage{
      max-height:280px;
      max-width:300px; 
      margin:5px;
      -webkit-border-radius: 10px;
      -moz-border-radius: 10px;
      border-radius: 10px;
      border:2px solid #000000;
      -webkit-box-shadow: #8F8F8F 5px 5px 5px;
      -moz-box-shadow: #8F8F8F 5px 5px 5px; 
      box-shadow: #8F8F8F 5px 5px 5px;
}

And change this:

echo "<img src=".$iPath." style='max-height:280px;max-width:300px;'>";

To this:

echo "<img src=".$iPath." class='galleryImage'>";

If you want different styling with nicer edges shadow etc.

http://cssround.com/

Is a easy tool to use then Smile
Interesting, I will probably need this in the future for a project or two.
fantastic still works a charm