suggests about photo script

This is a discussion on suggests about photo script within the alt.comp.lang.php forums, part of the PHP Programming Forums category; basically I have a scripty I am using as a photo album, nothing complex just something I picked up that ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-12-2004
Wayne...
 
Posts: n/a
Default suggests about photo script

basically I have a scripty I am using as a photo album, nothing complex just
something I picked up that does teh job.... wel sort of and the reason why I
am having this particular problem is playing with my head as I can't see why
its broke.

I am using the same script twice {the script itself recursively lists the
images in a directory} so one version has one lot of photo's the other has
different ones. Its the same script just with a few config changes. So I
can't understand why it acts differntly on these pages:

http://www.dashdotslash.net/starwars.php << works
http://www.dashdotslash.net/artwork.php <<<Doesn't work

Both are using 'require once' includes. The once that doesn't work when
included is included from here and works fine here!
http://www.dashdotslash.net/myartwork/

I'll stick the script iotself below as its got me beat why one version
works and another doersn't [unless it's due to the fact that the working one
is nested in the actual main domain not a folder. (
http://www.dashdotslash.net/album.php )
Why would this cause a problem as all links are fine as far as I can see.
I've even tried ful paths all to no avail.
Thanks in advance.

Wayne...


code :(the only differnce in this part of the script is that the one that
works has links to 'img/thumbs' instead of 'images/thumbs' )
===

<?
$i =1;
$files = array ();
$myDirectory = opendir("images/thumbs");
echo "<table width='$table_width' bgcolor = '$table_bg_color' border
='$table_border' cellpadding='5' cellspacing='0'><tr>";
while ($file = readdir($myDirectory)) {

if (($file != ".") && ($file != "..") && ($file != "index.php") &&
!(is_dir("images/$file")) )
{
$files[] = $file;
if (is_int($i / $cols)) {
list($width, $height) = getimagesize("images/$file");
echo "<td align='center'>";
?>
<a href="#" onClick="MyWindow=window.open('viewer.php?file=<?p hp
echo
$file;?>','MyWindow','toolbar=no,location=no,direc tories=no,status=yes,menub
ar=no,scrollbars=no,resizable=no,width=<?php echo "$width";?>,height=<?php
echo "$height";?>,left=20,top=20'); return false;">
<?
echo "<img src='images/thumbs/$file' border='0'></a>";
echo "</td></tr><tr>";
}
else
{
list($width, $height, $type, $attr) = getimagesize("images/$file");
echo "<td align='center'>";
?>
<a href="#" onClick="MyWindow=window.open('viewer.php?file=<?p hp
echo
$file;?>','MyWindow','toolbar=no,location=no,direc tories=no,status=yes,menub
ar=no,scrollbars=no,resizable=no,width=<?php echo "$width";?>,height=<?php
echo "$height";?>,left=20,top=20'); return false;">
<?
echo "<img src='images/thumbs/$file' border='0'></a>";
echo "</td>";
}
$i++;
}
}
echo "</tr></table>";
closedir($myDirectory);
?>



Reply With Quote
  #2 (permalink)  
Old 12-12-2004
Hilarion
 
Posts: n/a
Default Re: suggests about photo script

Both scripts work OK. Second one is not configured correctly, so it generates
<img> tags showing images from nonexisting folder ("images/thumbs" instead of
"imgs/thumbs").

When you see "broken image" icon, then check value of "src" attribute of
the image tag before blaming PHP scripts.


Hilarion


Reply With Quote
  #3 (permalink)  
Old 12-12-2004
Wayne...
 
Posts: n/a
Default Re: suggests about photo script


"Hilarion" <hilarion@SPAM.op.SMIECI.pl> wrote in message
news:cpic6r$arv$1@news.onet.pl...
> Both scripts work OK. Second one is not configured correctly, so it

generates
> <img> tags showing images from nonexisting folder ("images/thumbs" instead

of
> "imgs/thumbs").
>
> When you see "broken image" icon, then check value of "src" attribute of
> the image tag before blaming PHP scripts.
>
>
> Hilarion
>

Actually this was on purpose. To make sure that the non working script
wasn't acessing the same folder as the first with the second one (damn this
is complex to explain easily!) I made a folder called 'images' containing
'thumbs'. Actually at one point this is what was appearing to happen as iot
was showing the wrong photo album! hence my reasoning.
I'll explain the layout of my folders and you'll see what I mean.

root contains:

starwars.php << this caled the include like this <?php
require_once('album/album.php'); ?>
artwork.php << calls the inluded like this <?php
require('myartwork/index.php'); ?>

[album] << folder containing same as 'myartwork' (see below)
index.php << same as 'album.php in [myartwork]
viewer.php << used to diaply pop ups of images clicked
[imgs] < contains [thumbs] folder and images (thumbs in obvious
place)

[myartwork] << folder containing the following :-
album.php << same as 'index.php in [albums]
viewer.php << used to diaply pop ups of images clicked
[imgs] < contains [thumbs] folder and images (thumbs in obvious
place)

BUT ALSO! I copied into the main root, a [img] folder with contents and
viewer.php. This is where I feel the problem is. By including these
files detailed for some reason one of them is pointing to the copied one in
root. I've tested this by deleting them on my test server here. I don't
understand if I need to changer tehfolders pointed to in the scripts or not.
I tried changing one to include a root folder but with no luck. any ideas
where the hell I am going wrong. I've explained it as best i can hope this
clears up the prob and makes the problem more obvious.

Wayne...


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:24 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0