Re: chdir() help
| From: | Kurt Lieber | Date: | Sat, 07 Jul 2001 18:17:55 +0000 |
| Subject: | Re: chdir() help | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56654@lists.php.net to get a copy of this message | ||
In that case, it would be better to read all the image names into an array
and then use that to spit out 20 images at a time. You'll get better
performance that way, too.
--kurt
----- Original Message -----
From: "McShen-CelebritieZones.com" <celebzone@sympatico.ca>
To: "Chris Lambert - WhiteCrown Networks" <chris@whitecrown.net>
Cc: <php-general@lists.php.net>
Sent: Saturday, July 07, 2001 11:08 AM
Subject: Re: [PHP] chdir() help
Chris,
I do that because i wanna have control of how many images will be displayed
at once. I understand what you are doing, but, you script will just display
all images at once, right? I wanna display like 20 images, then have a next
button,, you know what i mean?
----- Original Message -----
From: "Chris Lambert - WhiteCrown Networks" <chris@whitecrown.net>
Newsgroups: php.general
To: "McShen" <hshen@crosswinds.net>
Cc: <php-general@lists.php.net>
Sent: Saturday, July 07, 2001 11:44 AM
Subject: Re: [PHP] chdir() help
> I'm not sure I know exactly what you want, as the script isn't clear on
its
> purpose. If you simply want to print out all the images in e:\work\image,
> and nothing else, the code would be much simpler.
>
> <?
> $dir = opendir("e:/work/image");
> while ($file_name=readdir($dir)) {
> if ($file_name <> "." && $file_name <> "..") {
> echo "<img src='image/$file_name'>";
> }
> }
> ?>
>
> /* Chris Lambert, CTO - chris@whitecrown.net
> WhiteCrown Networks - More Than White Hats
> Web Application Security - www.whitecrown.net
> */
>
> ----- Original Message -----
> From: McShen <hshen@crosswinds.net>
> To: <php-general@lists.php.net>
> Sent: Saturday, July 07, 2001 11:38 AM
> Subject: [PHP] chdir() help
>
>
> hi
>
> Currently, i am working in e:\work, and there is a folder named "image"
> under e:\work, so, the path to image is e:\work\image.
>
> I have a script under e:\work, and i wanna display all images under the
> folder e:\work\image, I use chdir() to change the directory. but it
wouldn't
> work. it still displays the images under e:\work. Why is that? Does
chdir()
> work under win2k pro? here is my script
>
> -------
> <?php
>
>
> $dir_name = "e:\work";
> $dir = opendir($dir_name);
> while ($file_name=readdir($dir)) {
>
> if (($file_name!="." && $file_name!="..")) {
> echo $file_name."\n ";
>
> if (chdir('e:\work\image')) {
> echo "current dir is e:\work\image";
> }
> echo "<IMG SRC=$file_name>";
> }
> }
> closedir($dir);
> ?>
> -----
>
> Please help me to fix the problem. Thanks.
>
>