Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Random picture block  (Read 5480 times)

0 Members and 1 Guest are viewing this topic.

romoracing

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Random picture block
« on: December 18, 2004, 05:45:49 am »

Hi,
I dont know if im posting this in the right place. but i have coppermine for phpnuke and i have the random picture block on the home page. But i dont like it because it has the picture then the tittle of the picture below it. So i was wondering if theres a way to remove it. Some one please help. Thank you-
The code:
Code: [Select]
<?php 
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.2 nuke RC5                                    //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002,2003  Grégory DEMAR <gdemar@wanadoo.fr>               //
// http://www.chezgreg.net/coppermine/                                      //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// (http://coppermine.sf.net/team/)                                          //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// New Port by GoldenTroll                                                  //
// http://coppermine.findhere.org/                                          //
// Based on coppermine 1.1d by Surf  http://www.surf4all.net/               //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify     //
// it under the terms of the GNU General Public License as published by     //
// the Free Software Foundation; either version 2 of the License, or        //
// (at your option) any later version.                                      //
// ------------------------------------------------------------------------- //
if (eregi("block-CPG-Random_pictures_center.php"$PHP_SELF)) { 
    
Header("Location: index.php"); 
    die(); 
}
define('CPG_BLOCKS'1);
define('NO_HEADER'true);  
global 
$prefix$db$CONFIG$Version_Num$cpg_dir;
global 
$ALBUM_SET;

$cpg_dir "coppermine";
$cpg_block true;
require(
"modules/".$cpg_dir."/include/load.inc.php");
$cpg_block false;

get_private_album_set();
$numberpic $CONFIG['thumbcols']; //number of thumbs
//$numberpic=4; //number of thumbs
$limit2 $numberpic;
$content="";
function 
truncate_string444c($str)

   
$maxlength 20// maximum lenght of name in block 
    
   
if (strlen($str) > $maxlength
      return 
substr($str0$maxlength)." ..."
   else 
      return 
$str

$content .= '<table width="100%" border="0" align="center" cols="'.$limit2.'" cellpadding="0" cellspacing="0"><tr>';
$result $db->sql_query("SELECT COUNT(*) from ".$cpg_prefix."pictures WHERE approved = 'YES' $ALBUM_SET");
$nbEnr $db->sql_fetchrow($result);
$pic_count $nbEnr[0];
// if we have more than 1000 pictures, we limit the number of picture returned
// by the SELECT statement as ORDER BY RAND() is time consuming
if ($pic_count 1000) {
    
$result $db->sql_query("SELECT COUNT(*) from ".$cpg_prefix."pictures WHERE approved = 'YES'");
    
$nbEnr $db->sql_fetchrow($result);
    
$total_count $nbEnr[0];

    
$granularity floor($total_count 1000);
    
$cor_gran ceil($total_count $pic_count);
    
srand(time());
    for (
$i 1$i <= $cor_gran$i++) $random_num_set rand(0$granularity) . ', ';
    
$random_num_set substr($random_num_set0, -2);
    
$result $db->sql_query("SELECT pid, aid, filepath, filename FROM ".$cpg_prefix."pictures WHERE randpos IN ($random_num_set) AND approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2");
} else {
    
$result $db->sql_query("SELECT pid, aid, filepath, filename FROM ".$cpg_prefix."pictures WHERE approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2");
}

while (
$row $db->sql_fetchrow($result)) {
    if (
$CONFIG['seo_alts'] == 0) {
   
$thumb_title $row['filename'];
    } else {
        if (
$row['title'] != '') {
            
$thumb_title $row['title'];
        } else {
            
$thumb_title substr($row['filename'], 0, -4);
        }
    }
    
stripslashes($thumb_title);
    
$content .= '<td align="center" valign="baseline"><a href="'$CPG_M_URL '&file=displayimage&pos=-'.$row["pid"].'"><img src="'.$row["filepath"].'thumb_'.$row["filename"].'" border="0" alt="'.$thumb_title.'" title="'.$thumb_title.'"><br>' truncate_string444c($thumb_title) . '</a></td>';
}
$content .= '</tr><tr align="center"><td colspan="'.$limit2.'" valign="baseline"><a href="'$CPG_M_URL '">'.$lang_pagetitle_php["photogallery"].'</a></center></td></tr></table>';
?>

Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Random picture block
« Reply #1 on: December 18, 2004, 05:55:24 am »

Sorry we can't help with phpnuke since we don't know it.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.