Jump to content


[Block] Random Coppermine Image 1.0


2 replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 09 September 2005 - 11:32 PM

File Name :: Random Coppermine Image Block 1.0
Author :: visiblesoul
Category :: MKportal Resources (M01-M05)
Description
|Random Coppermine Image 1.0 01.01.2005
| for Coppermine Standalone v 1.3.2
| by visiblesoul
| adapted from MkPortal random_pic.php by Meo & Peter
+--------------------------------------------------------------------------

Block is for MKPortal x Coppermine Standalone v 1.3.2
Recommended for use as side block.

* This block displays:
1) Random thumbnail image from Coppermine gallery.
2) Image title.
3) Thumbnail and title link to the album that the displayed image comes from (not to the individual image).

View File


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#2 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 09 September 2005 - 11:35 PM

To display images only from specified albums...

Quote

$query = $DB->query("SELECT pid, aid, title, filepath, filename FROM cpg132_pictures WHERE aid IN (1,2,3) ORDER BY RAND() LIMIT 1");

In place of "1,2,3" put the id number of the albums you want to rotate. You can see what the album id number is by looking at the URL.

For example, this would be album #3.

thumbnails.php?album=3



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard

#3 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 09 September 2005 - 11:38 PM

Here is a modified version of the block by mobarmeg at hotmail dot com that is purported to work if the Coppermine gallery is in a different database than MKPortal. I have not tested this one but it might be useful to somebody.

<?php
/*
+--------------------------------------------------------------------------
|  MkPortal Random Coppermine Image 1.0 01.01.2005
|  for Coppermine Standalone v 1.3.2
|  by visiblesoul <visiblesoul.net>
|  adapted from MkPortal random_pic.php by Meo & Peter <mkportal.it>
+--------------------------------------------------------------------------
|   > MKPortal
|   > Written By Amedeo de longis
|   > Date started: 9.2.2004
+--------------------------------------------------------------------------
*/

$content = "";

/* Change this */
$COPPERMINE_DB = 'your_gallery_database_name';
$MKPORTAL_DB = 'your_forum_database_name';
/* /Change this */

MySQL_Select_DB($COPPERMINE_DB) Or Die(MySQL_Error());

	  $query = $DB->query("SELECT pid, aid, title, filepath, filename FROM cpg132_pictures ORDER BY RAND() LIMIT 1");

	  $photo = $DB->fetch_row($query);
	  $aid  = $photo['aid'];
	  $title  = $photo['title'];
	  $filepath = $photo['filepath'];
	  $filename = $photo['filename'];
	  $thumb = "thumb_$filename";



			  $content = "<tr align="center"><td><a href="../../gallery/thumbnails.php?album={$aid}"><img src="../../gallery/albums/{$filepath}{$thumb}" border="0" alt="{$title}"></a></td></tr>
			  <tr><td id="tdblock" align="center" style="text-align:center; text-decoration: none;"><a href="../../gallery/thumbnails.php?album={$aid}">$title</a>
</td></tr>";


  unset($photo);
  unset($aid);
  unset($title);
  unset($filepath);
  unset($filename);
  unset($thumb);


MySQL_Select_DB($MKPORTAL_DB) Or Die(MySQL_Error());
?>



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users