|
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
Thanks for the with escaping that line. My gallery works great.
Just lines up the pictures and if you resize they move with it instead of using tables. Added a class to pad each image and looks pretty clean. The code: <?php //Open images directory $dir = opendir("images"); //List files in images directory while (($file = readdir($dir)) !== false) { echo "<img src='images/$file' class=\"pad1em\">"; } closedir($dir); ?> Actually going to replace images with thumbs and make the thumbs link out to an image. But not until I get rid of the . and .. image holders. I've been reading the manual and have been trying to replace the readdir with is_file with mixed results, none good. while (($file = is_file($dir)) !== false) Replacing readdir with is_file straight just gave me the page with no images or image markers. while (($file = is_file($dir)) !== true) Then I left as is and changed the false to true and the page took about 20 seconds and then I stopped it and ended up with thousands of ? image markers or place holders or whatever they are called. while (($file = is_file($dir)) == true) This gave me my full pages but no images or markers. At this point I think it's clear I'm lost. And tired. Seems to me that if $file is a dir then it tries again in the while statement. Then it should hit the .. directory and try again. Now it should hit a real file and do what is inside of the {}. Rinse and repeat. Somehow made an infinite loop. So the original readdir keeps going until it tests as false. Maybe i need a while inside of a while but maybe an easier way. Thanks for any . ![]() <snooze> |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
Confused but working on it wrote:
> Thanks for the with escaping that line. My gallery works great. > Just lines up the pictures and if you resize they move with it instead > of using tables. Added a class to pad each image and looks pretty clean. > The code: > <?php > //Open images directory > $dir = opendir("images"); > //List files in images directory > while (($file = readdir($dir)) !== false) > { > echo "<img src='images/$file' class=\"pad1em\">"; > } > closedir($dir); > ?> > > Actually going to replace images with thumbs and make the thumbs link > out to an image. But not until I get rid of the . and .. image holders. > > I've been reading the manual and have been trying to replace the readdir > with is_file with mixed results, none good. > while (($file = is_file($dir)) !== false) > Replacing readdir with is_file straight just gave me the page with no > images or image markers. > while (($file = is_file($dir)) !== true) > Then I left as is and changed the false to true and the page took about > 20 seconds and then I stopped it and ended up with thousands of ? image > markers or place holders or whatever they are called. > while (($file = is_file($dir)) == true) > This gave me my full pages but no images or markers. > > At this point I think it's clear I'm lost. And tired. > Seems to me that if $file is a dir then it tries again in the while > statement. > Then it should hit the .. directory and try again. > Now it should hit a real file and do what is inside of the {}. > Rinse and repeat. Somehow made an infinite loop. > So the original readdir keeps going until it tests as false. Maybe i > need a while inside of a while but maybe an easier way. > > Thanks for any . > ![]() > <snooze> > You can't replace the readdir() call - that's what fetches the next directory entry. is_file() is something completely different. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
On 2007-09-12 05:11:01 -0700, Jerry Stuckle <jstucklex@attglobal.net> said:
>> Thanks for any . >> ![]() >> <snooze> >> > > You can't replace the readdir() call - that's what fetches the next > directory entry. is_file() is something completely different. This is what I finished with last night:" <?php //Open images directory $dir = opendir("images"); //List files in images directory while (($file = readdir($dir)) !== false) { while (($file = is_file($dir)) == true) { echo "<img src='images/$file' class=\"pad1em\">"; } } closedir($dir); ?> Doesn't displa my images but doesnt break eaither. Going to just trying to match .jpg before gopine to the echo... Thx for your |
|
![]() |
| Outils de la discussion | |
|
|