473,395 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Escaped has become is_file help

Thanks for the help 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 help.
:)
<snooze>

Sep 12 '07 #1
2 1370
Confused but working on it wrote:
Thanks for the help 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 help.
:)
<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.
js*******@attglobal.net
==================
Sep 12 '07 #2
On 2007-09-12 05:11:01 -0700, Jerry Stuckle <js*******@attglobal.netsaid:
>Thanks for any help.
:)
<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 help

Sep 12 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil Powell | last post by:
Code snippet: if (!($dirID = opendir($ACTUAL_STARTPATH . '/content/')) && $hasCookie) { $html .= $font . '<font color=cc0000><li>Could not open files in content folder</li></font></font><p>'; }...
1
by: news.hunterlink.net.au | last post by:
(* note the escaped ampersand and the character reference have extra spaces to avoid being converted when viewed) I have a job that requires the following <ThisElement>Here is some text & a m...
7
by: Jonny | last post by:
Hi, I am trying to write a C function which will dequote the string in a char * variable, and unescape any escaped quotes, so that, for example: "hello" would become: hello
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
6
by: comp.lang.php | last post by:
/** * Generate the random security image * * @access public * @param $willUseFilePath (default false) boolean to determine if you will be using a file path * @param mixed $filePath (optional)...
6
by: Kimmo Laine | last post by:
Running IIS 6 on Windows 2003 server. After an update to the most recent version of php 5.1.2, for some reacon a function handling uploaded files using is_file stopped working. is_file failed...
5
by: Tyno Gendo | last post by:
How do you normally check filetypes? I ended up resorting to !is_dir($file) as all other calls seem to fail so I had to assume if not a directory its a file, rather than specifically checking if...
2
by: jaimebienlesfruits | last post by:
Hi guys, I'm a newbie at PHP. For the past few weeks, I've been trying to work a on PHP layout/template and creating a dynamic site, so that the pages look something like...
12
by: Torsten Bronger | last post by:
Hallöchen! I need some help with finding matches in a string that has some characters which are marked as escaped (in a separate list of indices). Escaped means that they must not be part of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.