Welcome! Log In Create A New Profile

Advanced

[PHP] image inventoryer

Posted by Kirk Bailey 
Kirk Bailey
[PHP] image inventoryer
April 08, 2012 05:40AM
<html>
<head>
<title>Image inventory of this directory</title>
<style TYPE="text/css">
body { margin-left: 10; margin-right: 10%; }
body {background-attachment:fixed;}
A:link, A:visited, A:active { text-decoration:none; }
A:hover { text-decoration:underline; }
..justify{text-align:justify;}
..center{text-align:center;}
</style>
</head>
<body bgcolor="#A0A0A0" TEXT="BLACK" LINKS="BLUE">
<CENTER>This page inventories the contents of this directory and
lists all image files in order- as
the computer determines such matters. Here is the full inventory.
<hr align="center">
<P>
<?php
foreach (glob("*.*") as $filename) {
echo '<img src="'.$filename.'">'."<br>\n$filename\n<P>\n";
}
?>
</body></html>


This works nicely. copied code from online manual, chainsaw editing
to fit, superglue in the spare parts needed and it lists them all
and composes proper img links to display on the inventory page. NOW
I have the tool i needed; can someone else put this to good work?

--
end

Very Truly yours,
- Kirk Bailey,
Largo Florida

kniht
+-----+
| BOX |
+-----+
think


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
tamouse mailing lists
Re: [PHP] image inventoryer
April 08, 2012 08:20AM
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey <[email protected]> wrote:
> <html>
> <head>
> <title>Image inventory of this directory</title>
> <style TYPE="text/css">
> body { margin-left: 10; margin-right: 10%; }
> body {background-attachment:fixed;}
> A:link, A:visited,  A:active { text-decoration:none; }
> A:hover { text-decoration:underline; }
> .justify{text-align:justify;}
> .center{text-align:center;}
> </style>
> </head>
> <body bgcolor="#A0A0A0" TEXT="BLACK" LINKS="BLUE">
> <CENTER>This page inventories the contents of this directory and lists all
> image files in order- as
> the computer determines such matters. Here is the full inventory.
> <hr align="center">
> <P>
> <?php
> foreach (glob("*.*") as $filename) {
>    echo '<img src="'.$filename.'">'."<br>\n$filename\n<P>\n";
> }
> ?>
> </body></html>
>
>
> This works nicely. copied code from online manual, chainsaw editing to fit,
> superglue in the spare parts needed and it lists them all and composes
> proper img links to display on the inventory page. NOW I have the tool i
> needed; can someone else put this to good work?

Well, congrats on a first somewhat useful program. All I have to say
now is: you have a long way to go.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Kirk Bailey
Re: [PHP] image inventoryer
April 08, 2012 04:20PM
Thank you!
Not QUITE the first; I have used snippets and small routines for a
while; however I did not know how to do this in php.

Turns out there are at least 2 methods: glob, and an iteration of
the directory with readdir() to build up an array, then one by one
print the elements in the array. In python this is not hard.
Iteration in python is somewhat different- not to mention getting
used to do blocks. Being so used to snake charming, learning a new
way means getting used to different procedures.

On 4/8/2012 2:18 AM, tamouse mailing lists wrote:
> On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey<[email protected]> wrote:
>> <html>
>> <head>
>> <title>Image inventory of this directory</title>
>> <style TYPE="text/css">
>> body { margin-left: 10; margin-right: 10%; }
>> body {background-attachment:fixed;}
>> A:link, A:visited, A:active { text-decoration:none; }
>> A:hover { text-decoration:underline; }
>> .justify{text-align:justify;}
>> .center{text-align:center;}
>> </style>
>> </head>
>> <body bgcolor="#A0A0A0" TEXT="BLACK" LINKS="BLUE">
>> <CENTER>This page inventories the contents of this directory and lists all
>> image files in order- as
>> the computer determines such matters. Here is the full inventory.
>> <hr align="center">
>> <P>
>> <?php
>> foreach (glob("*.*") as $filename) {
>> echo '<img src="'.$filename.'">'."<br>\n$filename\n<P>\n";
>> }
>> ?>
>> </body></html>
>>
>>
>> This works nicely. copied code from online manual, chainsaw editing to fit,
>> superglue in the spare parts needed and it lists them all and composes
>> proper img links to display on the inventory page. NOW I have the tool i
>> needed; can someone else put this to good work?
> Well, congrats on a first somewhat useful program. All I have to say
> now is: you have a long way to go.
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Tedd Sperling
Re: [PHP] image inventoryer
April 08, 2012 05:20PM
Kirk:

Okay, you took the first step. Now please review this:

<?php
foreach (glob("images/*.jpg") as $filename)
{
echo("<img src=\"$filename\"><br>$filename <br><br>");
}
?>

Note:

1. This example does not put in all the embedded formatting shown in your example. What you did was simply bad form -- you should learn css as well. Also, you don't need to place the code within a bunch of html -- it will work "as-is".

2. I always want my students to place images in an image directory -- the above conforms to that.

3. The example also shows how to separate the jpg's from other files in the directory.


So, where do you want to go now?

Cheers,

tedd


_____________________
tedd.sperling@gmail.com
http://sperling.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login