[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

Variable issue with PHP/Javascript

Hi guys!

I have a slight problem that Id love for you guys to help me solve.

I have the following code in a php file.

=====================================================================
<script type="text/javascript">
function opacity(id, opacStart, opacEnd, millisec) {
      //speed for each frame
      var speed = Math.round(millisec / 100);
      var timer = 0;

      //determine the direction for the blending, if start and end are the same nothing happens
      if(opacStart > opacEnd) {
            for(i = opacStart; i >= opacEnd; i--) {
                  setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
                  timer++;
            }
      } else if(opacStart < opacEnd) {
            for(i = opacStart; i <= opacEnd; i++)
                  {
                  setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
                  timer++;
            }
      }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
      var object = document.getElementById(id).style;
      object.opacity = (opacity / 100);
      object.MozOpacity = (opacity / 100);
      object.KhtmlOpacity = (opacity / 100);
      object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
      //if an element is invisible, make it visible, else make it ivisible
      if(document.getElementById(id).style.opacity == 0) {
            opacity(id, 0, 100, millisec);
      } else {
            opacity(id, 100, 0, millisec);
      }
}

function blendimage(divid, imageid, imagefile, millisec) {
      var speed = Math.round(millisec / 100);
      var timer = 0;
      
      //set the current image as background
      document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
      
      //make image transparent
      changeOpac(0, imageid);
      
      //make new image
      document.getElementById(imageid).src = imagefile;

      //fade in image
      for(i = 0; i <= 100; i++) {
            setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
            timer++;
      }
}

function currentOpac(id, opacEnd, millisec) {
      //standard opacity is 100
      var currentOpac = 100;
      
      //if the element has an opacity set, get it
      if(document.getElementById(id).style.opacity < 100) {
            currentOpac = document.getElementById(id).style.opacity * 100;
      }

      //call for the function that changes the opacity
      opacity(id, currentOpac, opacEnd, millisec)
}


</script>


<script type="text/javascript">
var galleryarray = new Array();

<?php
$images = glob('panorama/*.jpg');
$indx = 0;
$init_pic = $images[array_rand($images)];
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='$pic';
";
            $indx++;
}
?>

var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>

<div id="gumax-site-logo">
    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/' . $init_pic; ?>    
<img src="<?php echo $sitelogo ?>" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>

</div>
======================================================================

The part of the code that im having problems with is:

 <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/' . $init_pic; ?>    

I can fix the first part by doing...

<?php   echo '<img src="http://localhost/mediawiki/skins/panorama/'  blah blah,

but its only the $int_pic returned value im having the issue with.

If I can get the above to look like this....

<?php   echo '<img src="http://localhost/mediawiki/skins/panorama/' . <image_file> '" />'; ?>

I will be really happy.

At the moment I have the following....

    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/' . $init_pic; ?>    
<img src="<?php echo $sitelogo ?>" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>

But the problem with the above is that $init_pic is returning the FULL path to the random image.
I only want $int_pic to return the randon image name it has selected  

eg. $int_pic to return

$int_pic = testimage.jpg

not

$int_pic = /var/www/html/mediawiki/testimage.jpg

I have been working on this constantly now for hours and cant get it working, so im calling on some megageniuses out there to please help.

Thank you so much.  :.)
0
Simon336697
Asked:
Simon336697
  • 21
  • 6
  • 3
2 Solutions
 
jasonsbytesCommented:
I guess this should work for you:

$sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/' . basename($int_pic);
0
 
Simon336697Author Commented:
Hi Jase!
Mate thank you for that.
Jase.
If I do the following:
<img src="<?php echo basename($int_pic) ?>
This returns
http://fire/mediawiki/index.php/

Then after 15 seconds, the path is:

http://fire/mediawiki/index.php/skins/panorama/mr_baby_elephant.jpg

In both cases, the image is not displayed.

If the returned path was:

http://fire/mediawiki/skins/panorama PLUS image variable (eg.$int_pic but only the filename)

eg.
http://fire/mediawiki/index.php/skins/panorama/mr_baby_elephant.jpg

This would load

So if there is any way to do the following....

<img src="<?php echo 'http://fire/mediawki/skins/  Plus image filename only from $init_pic?>

this would work. Ive got no idea how to do this. :<(
0
 
Simon336697Author Commented:
Im wondering if this part of the code:

function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);

the
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
is returning the full path pluas the index.php part that is stuffing this up.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jasonsbytesCommented:
I'm confused, what exactly is in $init_pic?
0
 
Simon336697Author Commented:
Jase thanks for you patience here mate i really really appreciate it.

Jase basically my php script has javascript in it that does opacity and setimer stuff applied to each new random image ($init_pic$) that is loaded by php code within the same php file.

Here is the code:

PHP File......
<!-- ########################## JAVASCRIPT STUFF TO DO THE EFFECTS ON IMAGES -->
<script type="text/javascript">
function opacity(id, opacStart, opacEnd, millisec) {
      //speed for each frame
      var speed = Math.round(millisec / 100);
      var timer = 0;

      //determine the direction for the blending, if start and end are the same nothing happens
      if(opacStart > opacEnd) {
            for(i = opacStart; i >= opacEnd; i--) {
                  setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
                  timer++;
            }
      } else if(opacStart < opacEnd) {
            for(i = opacStart; i <= opacEnd; i++)
                  {
                  setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
                  timer++;
            }
      }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
      var object = document.getElementById(id).style;
      object.opacity = (opacity / 100);
      object.MozOpacity = (opacity / 100);
      object.KhtmlOpacity = (opacity / 100);
      object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
      //if an element is invisible, make it visible, else make it ivisible
      if(document.getElementById(id).style.opacity == 0) {
            opacity(id, 0, 100, millisec);
      } else {
            opacity(id, 100, 0, millisec);
      }
}

function blendimage(divid, imageid, imagefile, millisec) {
      var speed = Math.round(millisec / 100);
      var timer = 0;
      
      //set the current image as background
      document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
      
      //make image transparent
      changeOpac(0, imageid);
      
      //make new image
      document.getElementById(imageid).src = imagefile;

      //fade in image
      for(i = 0; i <= 100; i++) {
            setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
            timer++;
      }
}

function currentOpac(id, opacEnd, millisec) {
      //standard opacity is 100
      var currentOpac = 100;
      
      //if the element has an opacity set, get it
      if(document.getElementById(id).style.opacity < 100) {
            currentOpac = document.getElementById(id).style.opacity * 100;
      }

      //call for the function that changes the opacity
      opacity(id, currentOpac, opacEnd, millisec)
}

</script>

<!-- ########################### PHP/JS STUFF TO RANDOMIZE IMAGES FROM FOLDER ### -->

<script type="text/javascript">
var galleryarray = new Array();

<?php
$images = glob('skins/panorama/*.jpg');
$indx = 0;
$init_pic = $images[array_rand($images)];
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='$pic';
";
            $indx++;
}
?>
<!-- ################################ JAVASCRIPT THAT DOES THE SETIMER STUFF ### -->
var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>
<div id="gumax-site-logo">
 
<!-- ####### echo path and random image eg.http://fire/mediawiki/skins/panorama/<random_image> -->
<img src="http://fire/mediawiki/<?php echo $init_pic ?>" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>
</div>
=============================================================================

Jase, I tried the above...
When the page first loads, it correctly loads the image....
http://fire/mediawiki/skins/panorama/mr_rhino_1.jpg is the path returned.
This is with:
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
and
<img src="http://fire/mediawiki/<?php echo $init_pic ?>"
But,
after a setimer delay,
The php stuff is correctly finding a random image, but the path its trying to load is:
http://fire/mediawiki/index.php/skins/panorama/mono_lake_936x267.jpg
----> with the index.php in the pathname F........g it up! :<(

If I try the following...
setTimeout("document.getElementById('blendimage').src = '"(galleryarray[rand]+"'", tm3*1000));
}
The first time the page loads, it loads the image, and after the settimer, it displays an image.....BUT ITS THE SAME IMAGE, and continues to display that same image ----> so the randomization stops if i do this.
0
 
Simon336697Author Commented:
Jase im pretty sure its

setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);

which is returning the index.php in the pathname returned along with the image.

I dont know what or how to fix this.
0
 
jasonsbytesCommented:
hmm, in your php somewhere, have it just 'echo $init_pic' so we can see what it is.  Then let me know.

thx, and no worries...
0
 
Simon336697Author Commented:
Jase i did this....
Here is the some of the source .....


</script>


<script type="text/javascript">
var galleryarray = new Array();

skins/panorama/mono_lake_936x267.jpggalleryarray[0]='skins/panorama/death_valley_flowers_panorama.jpg';
galleryarray[1]='skins/panorama/metallica_pub_glasses.jpg';
galleryarray[2]='skins/panorama/mono_lake_936x267.jpg';
galleryarray[3]='skins/panorama/morocco.jpg';
galleryarray[4]='skins/panorama/mr_baby_elephant.jpg';
galleryarray[5]='skins/panorama/mr_rhino_1.jpg';
galleryarray[6]='skins/panorama/namibie_desert.jpg';
galleryarray[7]='skins/panorama/open.jpg';

var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>

<!-- NAD, MATE ------- END OF PHP FILE EMBEDDED HERE :>)      -->



<div id="gumax-site-logo">
 
<img src="http://fire/mediawiki/skins/panorama/mono_lake_936x267.jpg" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>
<!-- In the above, if I type in -->
<!-- <img src="http://localhost/mediawiki/" /> -->
<! The above works to get the filename, replace the $files bit with a hardcoded file. This works. -->
</div>

0
 
Simon336697Author Commented:
Jase another example of the first image loading and none other after that...

<script type="text/javascript">
var galleryarray = new Array();

skins/panorama/death_valley_flowers_panorama.jpggalleryarray[0]='skins/panorama/death_valley_flowers_panorama.jpg';
galleryarray[1]='skins/panorama/metallica_pub_glasses.jpg';
galleryarray[2]='skins/panorama/mono_lake_936x267.jpg';
galleryarray[3]='skins/panorama/morocco.jpg';
galleryarray[4]='skins/panorama/mr_baby_elephant.jpg';
galleryarray[5]='skins/panorama/mr_rhino_1.jpg';
galleryarray[6]='skins/panorama/namibie_desert.jpg';
galleryarray[7]='skins/panorama/open.jpg';

<div id="gumax-site-logo">
 
<img src="http://fire/mediawiki/skins/panorama/death_valley_flowers_panorama.jpg" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>
</div>
0
 
Simon336697Author Commented:
Jase I put the echo in in the following section....

<?php
$images = glob('skins/panorama/*.jpg');
$indx = 0;
$init_pic = $images[array_rand($images)];
echo $init_pic;
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='$pic';
";
0
 
MasonWolfCommented:
Just change this:
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='$pic';
";
            $indx++;
}
?>

To this:
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='".array_pop(explode('/',$pic))."'";
";
            $indx++;
}
?>
0
 
Simon336697Author Commented:
Hi Mase thank you for your help on this.
Ive been busting myself on this.
Mase...when I input your code.....the page doesnt display at all. :<(
0
 
MasonWolfCommented:
oops, forgot about the newline there. Here ya go.

foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='".array_pop(explode('/',$pic))."';\n";
            $indx++;
}
0
 
Simon336697Author Commented:
Mase!
The first image loads, all subsequent fail.
First time the iimage loads, its loading from the correct location, which is
http://fire/mediawiki/skins/panorama/open.jpg

After the timer kicks in ... i think step 3 in the javascript code, to load a new image, the path it tries to load is from:
http://fire/mediawiki/index.php/mr_baby_elephant.jpg
Its the damn index.php that is stuffing this up somehow. I dont know why after a timer interval (without a page refresh), it goes from the right path to a path with index.php in it.
The first initial image isnt in the galleryarray i dont think so its not affected, which with my dumb bum mind means the path is right. So im guessing its got to be where you and Jase are working on, in the php code for the galleryarray.

Mase, I did an echo on the init_pic$ variable, and here is the source :.)

<?php
$images = glob('skins/panorama/*.jpg');
$indx = 0;
$init_pic = $images[array_rand($images)];
echo $init_pic;  ===========================> Echoed it out here.
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='".array_pop(explode('/',$pic))."';\n";
            $indx++;
}
?>

View Source:
===================================================================
</script>


<script type="text/javascript">
var galleryarray = new Array();

skins/panorama/metallica_pub_glasses.jpggalleryarray[0]='death_valley_flowers_panorama.jpg';
galleryarray[1]='metallica_pub_glasses.jpg';
galleryarray[2]='mono_lake_936x267.jpg';
galleryarray[3]='morocco.jpg';
galleryarray[4]='mr_baby_elephant.jpg';
galleryarray[5]='mr_rhino_1.jpg';
galleryarray[6]='namibie_desert.jpg';
galleryarray[7]='open.jpg';

var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>

<!-- NAD, MATE ------- END OF PHP FILE EMBEDDED HERE :>)      -->



<div id="gumax-site-logo">
 
<img src="http://fire/mediawiki/skins/panorama/metallica_pub_glasses.jpg" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>

0
 
Simon336697Author Commented:
Any possilbe luck Mase ?  :>)
0
 
MasonWolfCommented:
I just don't see what could cause it!

Try replacing:
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
with:
document.getElementById('blendimage').src=galleryarray[rand];

The timing will be off, but it will be interesting to see if the pictures work. If it does, maybe you could build a workaround based on that.
0
 
Simon336697Author Commented:
Youve been so helpful.
This one has been killing me.
You are really fantastic to offer your expertise here...I really am grateful.
In about an hour I will try this out.
0
 
MasonWolfCommented:
oh hang on a sec...

Do you have URL-rewriting turned on through your .htaccess file? Maybe you need to fix a regular expression there.
0
 
Simon336697Author Commented:
Mase!
YOU MAYBE ON TO SOMETHING HERE MATE!
To access my Mediawiki, I have placed a .htaccess file in the same directory as my wiki install.

That is:
http://fire/mediawiki/index.php
I first need to authenticate here, which is done by the .htaccess file.
Then Im in, and the php file (which is the skin Im using loads up).
I dont know how to check if URL-rewriting is turned on.
0
 
Simon336697Author Commented:
Mase another thing Ive noticed is below.

On page http://fire/mediawki/index.php ------> status quo ---> that is.....image displays the first time, timer kicks in, then no image from that point on.
BUT:
If on the same page, I click on edit:
http://fire/mediawiki/index.php?title=Change_Log&action=edit
EVERYTHING WORKS 100%
THAT IS......THE IMAGE INITIALLY LOADS---> TIMER KICKS IN---> IMAGE CHANGES!!!!!!!!!
BUT ONLY IF I HAVE TO EDIT THE PAGE
0
 
Simon336697Author Commented:
The view source code when I do this on Edit Page is:



<script type="text/javascript">
var galleryarray = new Array();
galleryarray[0]='skins/panorama/death_valley_flowers_panorama.jpg';
galleryarray[1]='skins/panorama/metallica_pub_glasses.jpg';
galleryarray[2]='skins/panorama/mono_lake_936x267.jpg';
galleryarray[3]='skins/panorama/morocco.jpg';
galleryarray[4]='skins/panorama/mr_baby_elephant.jpg';
galleryarray[5]='skins/panorama/mr_rhino_1.jpg';
galleryarray[6]='skins/panorama/namibie_desert.jpg';
galleryarray[7]='skins/panorama/open.jpg';

var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>

<div id="gumax-site-logo">
 
<img src="http://fire/mediawiki/skins/panorama/mr_rhino_1.jpg" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>
0
 
Simon336697Author Commented:
Another thing with the status quo as it is Mase:

Initial load of page ----> displays image 1
15 seconds later ---> no image

Looking at the view source after 15 seconds to see the contents of img src in the div, the img src HAS NOT BEEN UPDATED.....it is keeping the same path to the first image that was loaded.
However if I click on the div - properties, the php code has found a new image, but is threading in the index.php
0
 
Simon336697Author Commented:
I removed the .htaccess file so I get straight in.
As soon as Im in the status quo is the same, but:

It works 100% on these 2 pages:

http://fire/mediawiki/index.php?title=Special:Userlogin&action=submitlogin&type=login&returnto=Main_Page

http://fire/mediawiki/index.php?title=Change_Log&action=edit

Any other page eg.

http://fire/mediawiki/index.php/Change_Log

http://fire/mediawiki/index.php/Site_Extensions

http://fire/mediawiki/index.php/MediaWiki_HOWTOs

It loads the image the first time ---> counter kicks in ----> no image.

0
 
Simon336697Author Commented:
This is the contents of my .htaccess file

[root@fire mediawiki]# cat .htaccess
AuthUserFile /access/.htpasswd
AuthType Basic
AuthName "Protected Page"
<Files "index.php">
Require valid-user
</Files>
[root@fire mediawiki]#

0
 
Simon336697Author Commented:
Mase!
If I add the following to the .htaccess password:

[root@fire sbin]# vi /var/www/html/mediawiki/.htaccess
RewriteEngine on
AuthUserFile /access/.htpasswd
AuthType Basic
AuthName "Protected Page"
#Options FollowSymLinks
#<IfModule mod_rewrite.c>
#RewriteEngine on
#</IfModule>
<Files "index.php">
Require valid-user
</Files>


I get an internal server error and nothing loads.
0
 
MasonWolfCommented:
so index.php?key=var is fine, but index.php/path/info not so much?

Here's what's happening:
When you call index.php with directory structure links the browser treats it like you're actually in a folder with that name. Javascript is interpreted client-side, so if the browser is tricked, then the script is going to point the wrong place.

The probable solution? Well, if it works on index.php?key=var then you just need to make a your image links absolute, so it won't matter if the browser thinks it's looking at the inside a subfolder.

foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='/fire/mediawiki/$pic';\n";
            $indx++;
}
0
 
Simon336697Author Commented:
Mase!!!!!!
AFTER HOURS AND HOURS AND HOURS OF TRYING TO GET THIS WORKING.........
                     
               << MATE HOW MUCH DO I OWE YOU!!!!!!!!!!!!!!!!!>

              << ITS WORKING MASE :>) >>

MY GOD IM BLOWN AWAY!!!!!!!!!!!!!

YOUR LOGIC WAS ONE HUNDRED AND 50% CORRECT AND I CANT BELIEVE THAT THIS PROBLEM IS NOW RESOLVED THANKS TO YOUR FANTASTIC INCREDIBLE EXPERTISE. CANT TELL U HOW HAPPY I AM.
And thank you to the other guys as well.........YOU REALLY ARE INCREDIBLE.
Really so much appreicate it Mase.

The only slight mod I had to do was:

$init_pic = $images[array_rand($images)];
foreach( $images AS $pic)
{
      echo "galleryarray[$indx]='/mediawiki/$pic';\n";
            $indx++;
}
?>

var tm1=2,tm2=15,tm3=1;
function step1()
{
   setTimeout("step2()",tm1*1000);
}
function step2()
{
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step3()",(tm2+tm3)*1000);
}
function step3()
{
  var rand=Math.floor(Math.random()*galleryarray.length);
   shiftOpacity('blendimage', tm3*1000);
   setTimeout("step2()",(tm1+tm3)*1000);
setTimeout("document.getElementById('blendimage').src = '"+galleryarray[rand]+"'", tm3*1000);
}
window.onload=step1;
</script>



<div id="gumax-site-logo">
 
<img src="http://fire/mediawiki/<?php echo $init_pic ?>" style="width: 928px; height: 147px; border: 1 none; filter: alpha(opacity=20); -moz-opacity: 20; opacity: 0;" id="blendimage""/>          
</div>

==========================
So, where you said to put
 echo "galleryarray[$indx]='/fire/mediawiki/$pic';\n";
eg./fire/mediawiki
I had to change this to just /mediawiki, because it was doubling up on /fire after the timer.

I HONESTLY CANT THANK YOU ENOUGH.

I dont know how you guys do this, as I struggle so much with this.

:>)    160 STARS APLUS ++++++++++++++++++++++++++++++++++++++++++++++++++++++
0
 
MasonWolfCommented:
You're very welcome. I'm glad I could help.

Honestly, I just couldn't see where the problem lay until you gave me the links to pages where it worked versus where it didn't. Glad to have that puzzle behind us.
0
 
Simon336697Author Commented:
YOU ARE SUCH A KIND AND GENEROUS GUY.
I HOPE OTHER PEOPLE KNOW HOW VALUABLE YOU ARE, AND HOW MUCH YOU HELP.
YOUVE HELP ME NO END :>)
Thank you Mase... I wish I could repay you somehow :>)
0
 
Simon336697Author Commented:
Thnku Mase and Jase!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 21
  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now