Re: [Beta] Gallery
in witch .httaccess?
You are not logged in. Please login or register.
Your gallery is very cool!
But there is some problem. Everything was cool, but I've changed some code to have images dumped into folders based on year/month/day (from here http://chevereto.com/foro/topic538-put- … hday.html) and now there is no any images in the gallery.
How to make images show from the subfolders too?
Thank you!
P.S. Sorry for the bad English ![]()
right now when viewing my gallery all the images open, maybe i've missed something, but how can I get it to disply 10 images per page?
Can someone attach a working copy of the gallery.php with the sorting code?
I can't make it work.
Thank you
I was really interested in having something like this on my main page. Either random images or the latest ones. It was actually quite easy to do. For those of you without the slightest bit of php sense, copy/paste this where you would like it to appear:
<?php
// credits to kkeith29
// by desiboy aka 3lite
$thispage = 'gallery.php';
$imageDir = 'thumbs/';
$perPage = 50; //total images to display per page
$perRow = 5; //total images per row
if ( isset( $_GET['reset'] ) ) {
unset( $_SESSION['chunks'] );
}
if ( !isset( $_SESSION['chunks'] ) ) {
if ( is_dir( $imageDir ) ) {
if ( $dir = opendir( $imageDir ) ) {
while ( ( $file = readdir( $dir ) ) !== false ) {
if ( $file !== '.' && $file !== '..' ) {
$images[] = $file;
}
}
closedir( $dir );
}
else {
die("Unable to read directory - {$imageDir}");
}
}
shuffle( $images );
$_SESSION['chunks'] = array_chunk( $images,$perPage );
}
$page = 1;
if ( isset( $_GET['page'] ) && $_GET['page'] > 0 ) {
$page = (int) $_GET['page'];
}
$images[] = $file;
$chunk =& $_SESSION['chunks'];
$total = count( $chunk );
$images[] = $file;
if ( isset( $chunk[$page-1] ) ) {
$images = $chunk[$page-1];
$html = "<table cellspacing=\"0\" cellpadding=\"3\">\n\t<tr>\n";
$i = 0;
foreach( $images as $image ) {
if ( $i == $perRow ) {
$html .= "\t</tr>\n\t<tr>\n";
$i = 0;
}
$html .= "\t\t<td><a href=\"/?v={$image}\"><img src=\"{$imageDir}{$image}\" /></a></td>\n";
$i++;
}
$html .= "\t<tr>\n";
if ( $total > 1 ) {
$nav = '';
if ( $page > 1 ) {
$nav .= "<a href=\"{$thispage}?page=1\">[FIRST]</a><a href=\"{$thispage}?page=" . ( $page - 1 ) . "\">[PREV]</a>";
}
$i = 1;
while( $i < $total + 1 ) {
$nav .= "<a href=\"{$thispage}?page={$i}\">[{$i}]</a>";
$i++;
}
if ( $page < $total ) {
$nav .= "<a href=\"{$thispage}?page=" . ( $page + 1 ) . "\">[NEXT]</a><a href=\"{$thispage}?page={$total}\">[LAST]</a>";
}
$html .= "\t<tr>\n\t\t<td colspan=\"{$perRow}\">{$nav}</td>\n\t</tr>\n";
}
$html .= "</table><br /><br /><a href=\"{$thispage}?reset=true\">Shuffle Images</a>";
echo $html;
}
?>Dumb I know, cause anyone can figure it out. But it works like a charm. I updated it to only show 5 but this is for Random images. I'm using the code for the latest images.
All you literally have to do is copy the php code out of what they have and paste it in index.php whereever you like.
Last edited by underthegun (2010-12-30 08:23:02)
thanks for this one underthegun but how to delete the next and shuffle thing? i only need the 5 images to show in my index page.. hope you can help me..
and also how to resize the random image>?
Thank you, this works perfect!
But I can't remove the .htacces , weird because i've tried everything.
Can you do this just for 2.0 ?????
Mods for 1.9 and 2.0 are totally incompatible since Chevereto was recoded from scratch.
Powered by PunBB, supported by Informer Technologies, Inc.
Powered by PunBB