Author Topic: Random images on other php pages -> after upgrade to 1.5  (Read 14534 times)

0 Members and 1 Guest are viewing this topic.

Offline goyo

  • Newbie
  • *
  • Posts: 18
    • View Profile
Random images on other php pages -> after upgrade to 1.5
« on: June 04, 2002, 10:53:20 PM »
final version not working.  :(

Here is the code, what should I change ?

Code: [Select]
<?php 
//your path Pfad to 4images-directory 
$root_path "../mypath/"

define&#40;'ROOT_PATH', $root_path&#41;; 
include&#40;ROOT_PATH.'global.php'&#41;; 
$random_image $site_template->clean_template&#40;get_random_image&#40;0,0&#41;&#41;; 
?>

<?php 
echo $random_image
?>



Thanks for your answer!

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Random images on other php pages -> after upgrade to 1.5
« Reply #1 on: June 05, 2002, 12:17:21 AM »
Hi,

this should work. Any error messages?

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline goyo

  • Newbie
  • *
  • Posts: 18
    • View Profile
Random images on other php pages -> after upgrade to 1.5
« Reply #2 on: June 05, 2002, 05:32:20 AM »
Quote from: Jan Sorgalla
Hi,
this should work. Any error messages?
Jan
I virtual included to an shtml page during the 1.5 beta testing and it worked great!

Now I updated to the final version and the image+text not showing up at all...I didn't change any path, just upgraded to the final from beta wich is working well.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Random images on other php pages -> after upgrade to 1.5
« Reply #3 on: June 05, 2002, 08:36:21 AM »
Hi,

i found the error. Try to open "includes/functions.php" and remove the following code:

Code: [Select]
if ($total_images < 1) {
  return $random_image_cache;
}


The use the following code to show the random image:

Code: [Select]
<?php
//your path Pfad to 4images-directory 
$root_path "./"

define('ROOT_PATH'$root_path); 
include(
ROOT_PATH.'global.php');
include(
ROOT_PATH.'includes/sessions.php');
$random_image $site_template->clean_template(get_random_image(0,0)); 
?>

<?php 
echo $random_image;
?>


Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline goyo

  • Newbie
  • *
  • Posts: 18
    • View Profile
Thank You Jan!
« Reply #4 on: June 05, 2002, 04:20:04 PM »
Now it's working...

Thank you again  :D

Offline puffdawg

  • Pre-Newbie
  • Posts: 2
    • View Profile
Random images on other php pages -> after upgrade to 1.5
« Reply #5 on: June 08, 2002, 11:43:02 PM »
Please check this:

http://www.xfera.biz/testes.php

I introduced that code you gave me, i corrected that code in functions.php and it gives me that error....

What shall i do?

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Random images on other php pages -> after upgrade to 1.5
« Reply #6 on: June 09, 2002, 07:57:45 AM »
Hi,

put the first part
Code: [Select]
<?php 
//your path Pfad to 4images-directory 
$root_path "./"

define&#40;'ROOT_PATH', $root_path&#41;; 
include&#40;ROOT_PATH.'global.php'&#41;; 
include&#40;ROOT_PATH.'includes/sessions.php'&#41;; 
$random_image $site_template->clean_template&#40;get_random_image&#40;0,0&#41;&#41;; 
?>

at the top of your file. Before any HTML Tags..

The second part
Code: [Select]
<?php 
echo $random_image
?>

you can put where you want to show the random image.

Greets Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline kaiand1

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Random images on other php pages -> after upgrade to 1.5
« Reply #7 on: June 09, 2002, 11:31:11 AM »
jetzt bekomme ich wenn ich /bilder/ als pfad verwende die meldung Warning: Unable to access /bilder/global.php in /home/www/htdocs/rosis-welt.de/1.php on line 6

Warning: Failed opening '/bilder/global.php' for inclusion (include_path='') in /home/www/htdocs/rosis-welt.de/1.php on line 6

Warning: Unable to access /bilder/includes/sessions.php in /home/www/htdocs/rosis-welt.de/1.php on line 7

Warning: Failed opening '/bilder/includes/sessions.php' for inclusion (include_path='') in /home/www/htdocs/rosis-welt.de/1.php on line 7

Fatal error: Call to a member function on a non-object in /home/www/htdocs/rosis-welt.de/1.php on line 8

und wenn ich nur bilder/ als pfad verwende habe ich nur eine weise seite

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Random images on other php pages -> after upgrade to 1.5
« Reply #8 on: June 09, 2002, 12:00:48 PM »
Hast Du auch weiter oben gelesen?
http://www.4homepages.de/forum/viewtopic.php?p=2648#2648

Gruß Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline puffdawg

  • Pre-Newbie
  • Posts: 2
    • View Profile
Random images on other php pages -> after upgrade to 1.5
« Reply #9 on: June 09, 2002, 02:12:54 PM »
Quote from: Jan Sorgalla
Hi,

put the first part
Code: [Select]
<?php 
//your path Pfad to 4images-directory 
$root_path "./"

define&#40;'ROOT_PATH', $root_path&#41;; 
include&#40;ROOT_PATH.'global.php'&#41;; 
include&#40;ROOT_PATH.'includes/sessions.php'&#41;; 
$random_image $site_template->clean_template&#40;get_random_image&#40;0,0&#41;&#41;; 
?>

at the top of your file. Before any HTML Tags..

The second part
Code: [Select]
<?php 
echo $random_image
?>

you can put where you want to show the random image.

Greets Jan


Ok.. it worked... check http://xfera.biz/testes.php

Now, i would like to put the link to that image one the image and remove the name of the user who upload the image... it that possible to do?

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Trotzdem Fehler
« Reply #10 on: June 23, 2002, 03:37:46 PM »
Habe die function.php geändernt und den Code eingebaut und erhalte folgende Fehlermeldung:

Warning: mt_rand(): Invalid range: 0..-1 in /mnt/ls1/04/238/00000011/htdocs/umleitung/4images/includes/functions.php on line 349

Woran liegt das, ist meine mysql version zu niedrig? bin bei strato

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Random images on other php pages -> after upgrade to 1.5
« Reply #11 on: June 23, 2002, 03:42:12 PM »
Ja, Deine MySQL Version ist zu niedrig und der Alternativ-Code hat leider noch einen kleinen Bug. Nachdem Du zwei Bilder hinzugefügt hast, sollte es funktionieren.

Gruß Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline dabri

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • http://www.12geschworene.de
Hab eine andere Lösung
« Reply #12 on: June 23, 2002, 04:48:25 PM »
Danke Jan, ging aber irgendwie doch nicht.

Hab mir dann anders geholfen ;) :


Habe die die lightbox.php (als Beispiel) lokal bearbeitet, indem ich

$main_template = "lightbox"; in

$main_template = "bild";

umgewandelt habe, die Datei dann in bild.php umgenannt und in das 4images Verzeichnis hochgeladen.

Habe dann in den Templates die Datei lightbox.html soweit umgearbeitet wie ich wollte und umgenannt in bild.html.

So hat man den gleichen Erfolg!

Ach wie schön!

Offline Hobit

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Random images on other php pages -> after upgrade to 1.5
« Reply #13 on: January 19, 2006, 09:59:43 PM »
Hallo Leute

Wer kann mir helfen. Ich habe die mod... für Zufallsbilder gezogen und weis nicht wie ich die einbauen soll in mein Forum.

Ich nutze das phpkit1.6.1

Ich will auf der HAuptseite ein Zufallsbild und die 5 neusten Bilder anzeigen lassen.

Für 4images muste ich eine neue Datenbank auf dem Server erstellen, weil ich sonst Probleme mit dem eigentlichen Forum gehabt hätte