|
Posted by Kimmo Laine on 05/25/05 22:54
"Andrew Weir" <andrewrussellweir@hotmail.com> kirjoitti
viestissδ:4294cdf1_3@mk-nntp-2.news.uk.tiscali.com...
> Hi all.
> I've been struggling with this for weeks. It's a gallery script that I
> downloaded from a website and modified to suit my needs. Part of the
> problem is that I'm no programmer, but I've a little experience so I can
> look at the code and figure out the gist of what it's doing.
>
> Unless I am very much mistaken, the script loads the contents of a
> selected folder into an array called $images:
>
> $images[] = array(
> 'filename' => $f,
> 'width' => $width,
> 'height' => $height,
> 'size' => $size
> );
>
> and spits them out as thumbnails into a table on the page:
>
> <img src="images/'.$whichimage.'"
> class= "link"
> border="0"
> '.$dimension.'
> hspace="10"
> vspace="10"
> alt="'.$images[$_GET["img"]][filename].'"
> title="'.$images[$_GET["img"]][filename].'">
>
> and this bit makes the thumbnails clickable to open full size in a new
> page:
>
> <a href="'.$_SERVER["PHP_SELF"].'?img='.$index.'" >
> <img class="link"
> src="images/'.$images[$index][filename].'"
> width="'.$thumb_width.'"
> border="0"
> vspace="'.$_vspace_.'"
> alt="'.$images[$index][filename].'"
> title="'.$images[$index][filename].'">
>
> When I test it on my local testing server everything is fine. When I test
> the page on the web server however, I get a slew of messages like this:
>
> PHP Notice: Use of undefined constant width - assumed 'width' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 372 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 377 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 381 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 382 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 386 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 370 PHP Notice: Use of undefined constant width - assumed 'width'
> in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 372 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 377 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 381 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 382 PHP Notice: Use of undefined constant filename - assumed
> 'filename' in
> C:\webspace\reseller\web00091\Oaklands.towerhamlets.sch.uk\www\gallery\index.php
> on line 386
>
> What I can't figure out is why it works locally and not on the server, and
> why it thinks 'width', 'filename', etc. are constants when they're part of
> the $images array.
>
> If anyone can help at all, that would be really great.
>
> Here's the page:
> http://www.oaklands.towerhamlets.sch.uk/gallery/index.php, and the whole
> script is attached.
>
> Andrew.
>
>
filename should be 'filename' and width should be 'width'.
The reason it works on your home server is that your php settings prevent
such warnings from being displayed, but your server displays them. The error
is that there is no such defined constant as filename, so it assumes that
you meant to write a string 'filename', you silly doofus, but you didn't,
did you? Qoute marks are missing. So it notifys that it assumed you meant
'filename' when you actually had plain filename there... And by doing so it
assumes correctly. Fix this by adding some quote marks or by suppressing
error mesages... (I'd fix the code if I was you)
--
"I am pro death penalty. That way people learn
their lesson for the next time." -- Britney Spears
eternal.erectionN0@5P4Mgmail.com
[Back to original message]
|