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 pictures on my homepage  (Read 6925 times)

0 Members and 1 Guest are viewing this topic.

RockCitySaint

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
    • http://www.jacksriver.net
Random pictures on my homepage
« on: July 13, 2005, 05:17:38 am »

I was just wondering if there was a way to put those random pictures on the index of my website instead of the index of my gallery... maybe an iframe or a php include, or something... I was gonna try to do it when I realized I don't really know where to start.

mmm breadcrumbs?

- RCS

P.S. Meant to post this in the theme boards. Sorry.
Logged

Nibbler

  • Guest
Re: Random pictures on my homepage
« Reply #1 on: July 13, 2005, 05:34:10 am »

Use CPMfetch - look in the mods board.
Logged

blindrain

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Random pictures on my homepage
« Reply #2 on: March 20, 2006, 12:35:33 am »

heres what i did
Code: [Select]
<?php
require "../Gallery/include/config.inc.php";
//Select random thumbnail file.
$link mysql_connect($CONFIG['dbserver'], $CONFIG['dbuser'], $CONFIG['dbpass'])    or die('Could not connect: ' mysql_error());
mysql_select_db($CONFIG['dbname']) or die('Could not select database');

// Performing SQL query

$query "SELECT * FROM ".$CONFIG['TABLE_PREFIX']."pictures, ".$CONFIG['TABLE_PREFIX']."albums WHERE ".$CONFIG['TABLE_PREFIX']."albums.aid = ".$CONFIG['TABLE_PREFIX']."pictures.aid and ".$CONFIG['TABLE_PREFIX']."albums.visibility ='0'  ORDER BY rand() limit 1";
$result mysql_query($query) or die('Query failed: ' mysql_error());
$line mysql_fetch_array($resultMYSQL_ASSOC);

$addrQuery "SELECT value FROM ".$CONFIG['TABLE_PREFIX']."config WHERE name = 'ecards_more_pic_target'";
$pathQuery "SELECT value FROM ".$CONFIG['TABLE_PREFIX']."config WHERE name = 'fullpath'";
$addrResult mysql_query($addrQuery) or die('Query failed: ' mysql_error());
$pathResult mysql_query($pathQuery) or die('Query failed: ' mysql_error());
$addrLine mysql_fetch_row($addrResult);
$pathLine mysql_fetch_row($pathResult);
mysql_free_result($result);
mysql_close($link);

echo 
"<a href=\"{$addrLine[0]}displayimage.php?pos=-{$line['pid']}\" target=\"_blank\"><img src=\"{$addrLine[0]}{$pathLine[0]}{$line['filepath']}thumb_{$line['filename']}\" alt=\"{$line['title']}\"border=0px></a>";

?>

just change the require line to the correct file
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Random pictures on my homepage
« Reply #3 on: March 20, 2006, 05:29:31 pm »

Thanks for your contrib. However, the script you have come up with doesn't respect permissions, so if people run a gallery that doesn't permit everybody to see every pic uploaded to it, the use of your custom script is not recommended. It doesn't take into account that fact that there can be other file types than images, so again the script will break if users have non-images in their gallery.

The dev team recommends using cpmFetch.
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 19 queries.