Author Topic: Random Pic as full Picture  (Read 5543 times)

0 Members and 1 Guest are viewing this topic.

Offline schnubbie

  • Pre-Newbie
  • Posts: 6
    • View Profile
Random Pic as full Picture
« on: July 02, 2007, 04:56:35 PM »
Hi..

D:bin auf der Suche nach einem Zufalls Vollbild. Die Code wirft ein Thumb aus... Meine SQL Kenntnisse reichen nicht um das umzuschreiben.
E:(google translator) are on the search for coincidence a frame. The code throws a Thumb out… My SQL of knowledge is not enough to rewrite around.
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''../album/');
define('YOUR_URL''http://www.pbmatrix.de/album/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments: $image_comments<br>\n";
?>

D:Hat von euch jemand eine ahnung wie das geht? Wäre nett wenn sicher einer meldet.
Danke schonmal
E:how can that be done? Thanks already times
Markus

manurom

  • Guest
Re: Random Pic as full Picture
« Reply #1 on: July 03, 2007, 12:41:36 AM »
Hello,
to display a full picture in the random block, simply change these two files:
-->>templates/your_template/random_image.html
-->>templates/your_template/random_cat_image.html


Put this code instead of the original one (in fact, change thumbnail to image):
Code: [Select]
{image}<br /><b>{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif image_is_new}<br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />{user_name}

Offline schnubbie

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: Random Pic as full Picture
« Reply #2 on: July 03, 2007, 08:54:11 AM »
 :mrgreen:

now I have large coincidence picture on the starting side. That was not which I wanted. http://www.pbmatrix.de/pb/random.php here should come a large picture. in random.php is the code which is you can see above.

In principle I would like to have spent a large picture on an empty php side. is that possible?

Grüße
Markus

manurom

  • Guest
Re: Random Pic as full Picture
« Reply #3 on: July 03, 2007, 09:35:03 AM »
OOOOPS!  :oops:
Really sorry. I did not really understood you used nicky's external random picture MOD. My fault, I did not read your post as well as I had to.
To display a large picture in an external site random block, try this modification from nicky's MOD:
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''../album/');
define('YOUR_URL''http://www.pbmatrix.de/album/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (
preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_media_file, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$media_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

echo 
"<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$media_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo 
"<b>$image_name</b><br>\n";
echo 
"Comments: $image_comments<br>\n";
?>
tested and working on the 1.7.4 version.

...and take back your random html template files to this:
Code: [Select]
{thumbnail}<br /><b>{image_name}</b>{if image_is_new} <sup class="new">{lang_new}</sup>{endif image_is_new}<br />
{if allow_comments}{lang_comments} {image_comments}{endif allow_comments}<br />{user_name}

Very sorry again...

Offline schnubbie

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: Random Pic as full Picture
« Reply #4 on: July 03, 2007, 09:43:24 AM »
Do not excuse you. So I learned  :D It works. WOW! Thank you so much!

manurom

  • Guest
Re: Random Pic as full Picture
« Reply #5 on: July 03, 2007, 09:51:11 AM »
Glad to know!  :D
But please restore your old random template html files in http://www.pbmatrix.de/album/index.php.
I would be so ashamed to hear that this ugly layout is my fault!  :lol:
I would really like my errors to keep beeing "without a trace"! :mrgreen:

Offline schnubbie

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: Random Pic as full Picture
« Reply #6 on: July 03, 2007, 10:03:35 AM »
I´m @ work. So give me 10 min.
Cannot say to my boss I stop my work because I work on my private album.  :mrgreen: