TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 728
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 376
  • Total: 376

Random photos from coppermine

Started by carver, September 22, 2005, 01:32:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

deniz

Quote from: carver on September 22, 2005, 01:32:19 AM
Thought some of you might find a use for this script. It will pull a random photo from the coppermine photo gallery.
The code in red can be edited to suit your needs
<?php

include_once( '/home/bowfishi/public_html/gallery/include/config.inc.php');

db_connect() || die(mysql_error());

function db_connect()
{
         global $CONFIG;
         $result = @mysql_connect($CONFIG['dbserver'],
$CONFIG['dbuser'], $CONFIG['dbpass']);
         if (!$result)
                 return false;
         if (!mysql_select_db($CONFIG['dbname']))
                 return false;
         return $result;
}

$result = mysql_query("SELECT filename,filepath from cpg132_pictures WHERE
approved='YES' AND aid <> 111 and owner_name='Carver' ORDER BY RAND() DESC LIMIT 1");
$row = mysql_fetch_array($result);

$filename = 'thumb_' . $row['filename'];
$filepath = $row['filepath'];

Header('Location:http://www.mysite.com/gallery/albums/' . $filepath .
$filename);
exit;
?>


You can put this in an HTML block and call this script as an image.
<BODY>
<IMG src="http://www.mysite.com/random_pic.php">
</BODY>


caver, just refresh screen gets new picture.
other case always same picture ???

ukrob12

Is it possible to do the same thing with the latest pictures uploaded?

garry

Got a working example somewhere

garry

Well this looks like what I have been looking for for my avatars but I am totally new to this block stuff

any chance of getting some step by step help to do this so I can get an idea what you are talking about

Crip

cmpfetch script has a step by in it for random Avatar
I have become comfortably numb!

Cripzone | Crip's Free 2.0.2 Themes



garry

I appreciate the comeback
but

I am really new to this stuff

whats " cmpfetch script " mean
where do I find it
what do I do with iy once I find it

IchBin

Garry, I know you're looking for the easy answers all in one place. But you'll find you learn a lot more by searching around. A simple google search will show you what and where to find cpmfetch. Click me

As to what to do with it, if you search in these forums you'll also find your answer.

garry

Well I looked as you sugested and all I found was information from people trying to use it but nothing to tell me where to find it 

Open to another sugestion

grin

IchBin

I went to the first link in google. Looked in the forum. Found a stickie for it. And now for your pleasure, here is the downloads page.

http://www.fistfullofcode.com/projects/copperminefetch/downloads.php

garry

Thank you for the link and the instructions

I followed your instructions and also found it

I never thought of straying of the post i went to originally , as with 46 pages of posts i would get lost in never never land and forget why I was there in the first place


This website is proudly hosted on Crocweb Cloud Website Hosting.