• [Mod] Random image / Zufallsbild 5 0 5 1
Currently:  

Author Topic: [Mod] Random image / Zufallsbild  (Read 869079 times)

0 Members and 4 Guests are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #540 on: October 26, 2008, 01:24:03 AM »
use in your index.html:
Code: [Select]
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?3'></SCRIPT>
note, ?1 ?2 and ?3 is just any numbers or strings to prevent browser from caching these scripts.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Relax2012

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Keylight Bildergalerie
Re: [Mod] Random image / Zufallsbild
« Reply #541 on: October 28, 2008, 01:09:33 PM »
Hallo,

gibt es hier in diesem Script die Möglichkeit, dass man nur die Zufallsbilder angezeigt bekommt, die im Querformat aufgenommen wurden? Demnach müssten über einen Filter alle Bilder im Hochformat ausgefiltert werden.

Bei der Anordnung der Zufallsbilder auf meiner Startseite der Homepage www.keylight-pictures.com sieht es sonst ziemlich blöd aus...   :(

Da die Abmessungen der Bilder im System vorhanden sind, müsste es doch eigentlich möglich sein, den Wert der Bildhöhe bzw. Bildbreite zu verarbeiten. Da ich mich aber mit php nicht auskenne, weiss ich auch nicht, wie man dies machen kann?  :?

Würde mich über einen Ratschlag riesig freuen.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------

Vermutlich ist das doch ein grösseres Problem - deswegen habe ich eine andere Lösung ausprobiert.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------


Viele Grüße
Klaus
« Last Edit: October 29, 2008, 08:43:53 PM by Relax2012 »

Offline nhomauhoaphuong

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #542 on: November 12, 2008, 08:48:42 PM »
okie i've read many post but i still can't make it work. please help me here.

my random.php file

Code: [Select]
<?php
define
('ROOT_PATH''./hinhanh/');
define('SCRIPT_URL''http://www.domainame.com/hinhanh/');
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'];
$full_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_thumb_file'];

print(
"
document.write('<a href=\""
.SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a>');
"
);
?>


and this is my test.html file that will be intergrated into my main index.php page... here is the code i put in there..

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
LOL
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?3'></SCRIPT>[/quote]

  </body>
</html>

but then i still can't make it works.
it still showing this error

it only show the word LOL when i view the test.html file... wont show those 3 images
« Last Edit: November 12, 2008, 08:55:55 PM by Nicky »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #543 on: November 12, 2008, 08:57:01 PM »


change
Code: [Select]
define('ROOT_PATH', './hinhanh/');to
Code: [Select]
define('ROOT_PATH', './');
and place the random.php where your 4images config.php is.. then it will work..
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline nhomauhoaphuong

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #544 on: November 12, 2008, 09:02:59 PM »
i did - my 4images dir is in ./hinhanh, the config.php is in that root too... i already take off the ./hinhanh/ now only define('ROOT_PATH', './');
but still not working ... i view the random.php file and it's shown these error.
Quote
Warning: include(ROOT/config.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 29

Warning: include() [function.include]: Failed opening 'ROOT/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 29

Warning: include(ROOT/includes/db_mysql.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 30

Warning: include() [function.include]: Failed opening 'ROOT/includes/db_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 30

Warning: include(ROOT/includes/constants.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 31

Warning: include() [function.include]: Failed opening 'ROOT/includes/constants.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 31

Fatal error: Class 'Db' not found in /home1/chuahuon/public_html/hinhanh/random.php on line 34

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #545 on: November 12, 2008, 09:04:04 PM »
Hallo,

gibt es hier in diesem Script die Möglichkeit, dass man nur die Zufallsbilder angezeigt bekommt, die im Querformat aufgenommen wurden? Demnach müssten über einen Filter alle Bilder im Hochformat ausgefiltert werden.

Bei der Anordnung der Zufallsbilder auf meiner Startseite der Homepage www.keylight-pictures.com sieht es sonst ziemlich blöd aus...   :(

Da die Abmessungen der Bilder im System vorhanden sind, müsste es doch eigentlich möglich sein, den Wert der Bildhöhe bzw. Bildbreite zu verarbeiten. Da ich mich aber mit php nicht auskenne, weiss ich auch nicht, wie man dies machen kann?  :?

Würde mich über einen Ratschlag riesig freuen.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------

Vermutlich ist das doch ein grösseres Problem - deswegen habe ich eine andere Lösung ausprobiert.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------


Viele Grüße
Klaus


hi & sorry, hab diesen post übersehen...
wenn die abmessung in deiner mysql DB drinnen sind, was normalerweise nicht der fall ist, dann ist es ja kein problem :)
wenn doch nicht.. dann wird das wohl nichts..
ausser jemand schreibt ein script der die bilder abmessungen in die datenbank reinbekommt.. danach, ist es kein problem mehr :)
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #546 on: November 12, 2008, 09:06:40 PM »
are you sure that you have this inside
Code: [Select]
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://www.domainame.com/hinhanh/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
?

and not

Code: [Select]
define('ROOT', './');
define('SCRIPT_URL', 'http://www.domainame.com/hinhanh/');
include(ROOT.'config.php');
include(ROOT.'includes/db_mysql.php');
include(ROOT.'includes/constants.php');
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline nhomauhoaphuong

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #547 on: November 13, 2008, 02:46:42 AM »
i got it. thanks alot.

but then i put this code into my index.php on main main page...
Quote
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?1' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?2' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?3' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?4' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?5' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?6' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?7' border='0' width='73' height='83'></SCRIPT>"

i got this and it's working now... but i seted the size of these images to be the same size.. like that ... but how come when it's shown it's not the same size.. so how do i make them all to be shown in one size.
please help.
thanks
« Last Edit: November 13, 2008, 03:40:09 PM by nhomauhoaphuong »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #548 on: November 13, 2008, 07:49:53 AM »
morning,

1st at all.
get back our 4images copyright into your templates.  :evil:
you know what i mean... clickable link to 4homepages.de below "Powered by 4images 1.7.6" ;)
THANK YOU!

2nd:
don't use width and height in your example.
edit your random.php to following:
Code: [Select]
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"0\" width=\"73\" height=\"83\" alt=\"$image_name\"></a>');
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline nhomauhoaphuong

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #549 on: November 15, 2008, 07:05:40 PM »
let say i want to make this random image switches every 3 seconds, make it like flash.. how do you do this.

Offline Dipi

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #550 on: November 21, 2008, 01:15:47 PM »

Ich habe da mal eine Frage. Was muss ich wo verändern, damit das Vorschaubild aus der Galerie auf meiner HP größer wird? Wo kann ich die Werte verändern?

Link zur HP:

http://www.german-spotter-network.de/

Viele Grüße

Dipi

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #551 on: November 21, 2008, 01:40:10 PM »
... das Vorschaubild ist halt so groß wie deine Thumbnails in deiner Galerie ...
... du müsstest also die Thumbnail-Größe in deiner Galerie ändern ... via ACP ...
... denn das Vorschaubild größer zerren als es ist ... macht wohl keinen Sinn ... ;)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Dipi

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #552 on: November 21, 2008, 01:50:25 PM »

Wenn das jetzt wirklich so einfach ist..... ich probier das gleich mal aus.

Offline Dipi

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #553 on: November 21, 2008, 02:11:35 PM »

Sauber, hat geklappt. Gibt es im ACP eine Funktion mit der ich alle bisher (zu kleinen) Thumbs löschen kann?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #554 on: November 21, 2008, 02:19:53 PM »
... eine Löschfunktion für die Thumbs im ACP gibt es nur über die Bild-bearbeiten-Seite ...
... sollte dir das zu mühselig sein, dann via FTP ... /data/media/thumbnails/ ... in den einzelnen Nr.-Ordnern die Thumbnails löschen ...
... und dann via ACP -> Auto-Thumbnailer die neuen, größeren Thumbnails erzeugen ...

... soweit zur Theorie ... und jetzt bist du dran ... ;)
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...