Re: [PHP] image inventoryer

2012-04-08 Thread tamouse mailing lists
On Sat, Apr 7, 2012 at 10:35 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 html
 head
 titleImage 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
 CENTERThis 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\nP\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



Re: [PHP] image inventoryer

2012-04-08 Thread Kirk Bailey

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 Baileykbai...@howlermonkey.net  wrote:

html
head
titleImage 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
CENTERThis 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\nP\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



Re: [PHP] image inventoryer

2012-04-08 Thread Tedd Sperling
Kirk:

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

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

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.sperl...@gmail.com
http://sperling.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] image inventoryer

2012-04-07 Thread Kirk Bailey

html
head
titleImage 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
CENTERThis 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\nP\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



Re: [PHP] image inventoryer

2012-04-06 Thread Jim Giner
Kirk Bailey kbai...@howlermonkey.net wrote in message 
news:4f7e5d2f.3050...@howlermonkey.net...
 jim, I am a novice at this language as I said.


Then you are taking on too big of a task.

When I decided to pick up some web programming skills I bought a $50 
book/manual on learning PHP and another on MySQL.  I read them - cover to 
cover.  Then I made up simple tasks to develop in order to LEARN how it's 
actually done.  Sounds like you not only want someone to program it for you, 
but probably help you implement it too.  Sure - I or someone with time on 
their hands - could reply back with a couple hundred lines of code and give 
you your answer.  Then what would you have gained?

Hey - I gave you the outline of how this goal of yours could be 
accomplished.  No need for your own pseudo-code at this point.  Take mine 
and go do some research!  Have fun!  Then come back for clarification on 
what you're doing wrong once you have some actual code written.


 And were people this nice to you when YOU asked beginner questions?

When I asked beginner questions, it was AFTER I had written something and 
ran into a roadblock.  NOT before I had set pen to paper.  You're asking how 
to get to California without having consulted a map yet.  This site will be 
there for you when you have a problem - don't worry.  Me included, not that 
my input is that worthy. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-06 Thread David OBrien
On Fri, Apr 6, 2012 at 8:34 AM, Jim Giner jim.gi...@albanyhandball.comwrote:

 Kirk Bailey kbai...@howlermonkey.net wrote in message
 news:4f7e5d2f.3050...@howlermonkey.net...
  jim, I am a novice at this language as I said.
 

 Then you are taking on too big of a task.

 When I decided to pick up some web programming skills I bought a $50
 book/manual on learning PHP and another on MySQL.  I read them - cover to
 cover.  Then I made up simple tasks to develop in order to LEARN how it's
 actually done.  Sounds like you not only want someone to program it for
 you,
 but probably help you implement it too.  Sure - I or someone with time on
 their hands - could reply back with a couple hundred lines of code and give
 you your answer.  Then what would you have gained?

 Hey - I gave you the outline of how this goal of yours could be
 accomplished.  No need for your own pseudo-code at this point.  Take mine
 and go do some research!  Have fun!  Then come back for clarification on
 what you're doing wrong once you have some actual code written.

 
  And were people this nice to you when YOU asked beginner questions?
 
 When I asked beginner questions, it was AFTER I had written something and
 ran into a roadblock.  NOT before I had set pen to paper.  You're asking
 how
 to get to California without having consulted a map yet.  This site will be
 there for you when you have a problem - don't worry.  Me included, not that
 my input is that worthy.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I googled php show images in folder and lo and behold  the first was was
a script almost exactly what you are wanting to do


Re: [PHP] image inventoryer

2012-04-06 Thread Jim Giner
David OBrien dgobr...@gmail.com wrote in message 
news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com...

 I googled php show images in folder and lo and behold  the first was was
 a script almost exactly what you are wanting to do

Damn - now the OP missed a golden opportunity to do some research!  :) 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-06 Thread David OBrien
On Apr 6, 2012 9:51 AM, Jim Giner jim.gi...@albanyhandball.com wrote:

 David OBrien dgobr...@gmail.com wrote in message
 news:CAF=yD_06vDEHLP-nyEJxUNt6nHexA42X90U5-6+MBzc0=tc...@mail.gmail.com...
 
  I googled php show images in folder and lo and behold  the first was
was
  a script almost exactly what you are wanting to do
 
 Damn - now the OP missed a golden opportunity to do some research!  :)



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


It's been my experience if they haven't even used google to see what
premade scripts are available to do something similar then the research
ain't gonna happen.

They'd just post on ee or another forum where they could get the answer
easier


Re: [PHP] image inventoryer

2012-04-06 Thread Tedd Sperling
On Apr 5, 2012, at 10:26 PM, Kirk Bailey wrote:

 I need a page that will live in a directory and list all image files in 
 there. That is, the page has
 img src=./foo.typeP
 tags emitted in it's structure, one per file in the directory with a saught 
 file type- .png, .gif, .jpg, you get the idea.
 this should use relative addressing so once the tool is built I can use it in 
 other directories as is.
 
 Now ai am still a novice at p[hp, how can I do this ?
 
 -- 
 end
 
 Very Truly yours,
 - Kirk Bailey,


Kirk:

That will be a good exercise for you. If you want help, then show us something 
where you did something other than ask for the code.

For example, show us *your* code (or attempt) to list all the files in a 
directory. That's pretty simple. After you do that, then we can move on to the 
next step.

Please realize we are not here to write code for you  but rather to help you 
with *your* code.

Cheers,

tedd

_
tedd.sperl...@gmail.com
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-06 Thread tamouse mailing lists
On Thu, Apr 5, 2012 at 10:04 PM, Kirk Bailey kbai...@howlermonkey.net wrote:
 jim, I am a novice at this language as I said.
 And were people this nice to you when YOU asked beginner questions?

When I ask beginner questions, I spend time doing my homework first.
This list is not a class to teach you to write PHP. The people here
are not going to hold your hand and feed you spoonfuls of PHP
knowledge. Read first. Ask smart questions. There are BOATLOADS of
tutorials on PHP on the net, just a google away.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-06 Thread Jim Giner

tamouse mailing lists tamouse.li...@gmail.com wrote in message 
news:CAHUC_t-M_dg_D+if01BQm=RPd=GgL7d=naxfadxwybse-nn...@mail.gmail.com...
 knowledge. Read first. Ask smart questions. There are BOATLOADS of
 tutorials on PHP on the net, just a google away.

I like that!  just a google away.  :) 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] image inventoryer

2012-04-05 Thread Kirk Bailey
I need a page that will live in a directory and list all image files 
in there. That is, the page has

img src=./foo.typeP
tags emitted in it's structure, one per file in the directory with a 
saught file type- .png, .gif, .jpg, you get the idea.
this should use relative addressing so once the tool is built I can 
use it in other directories as is.


Now ai am still a novice at p[hp, how can I do this ?

--
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



Re: [PHP] image inventoryer

2012-04-05 Thread Tommy Pham
On Thu, Apr 5, 2012 at 7:26 PM, Kirk Bailey kbai...@howlermonkey.net wrote:

 Now ai am still a novice at p[hp, how can I do this ?


Have you read any book on PHP?  even the official from PHP.net?  Learn
the tool so you know how to use it, efficiently.  Otherwise how do you
know if the tool can do what you want...  What you're asking for ATM
is someone to write the code for you which is not how it works.  You
need to provide some code, or even pseudo code at least...

HTH,
Tommy

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-05 Thread Jim Giner
As Tommy says - you sound like a total new user who doesn't know how to do 
it and furthermore doesn't know how many things you are going to have to 
pick up just to accomplish this task.

You have to:

determine the folder your script is running from
collect an array of  image file names from that directory
determine the size of each of these images so that you are not building some 
html that will try to display an unmanageable amount of data all at once. 
You may then have to learn how to create smaller images for your img tags, 
which is another learning process in itself
determine how many images you will display and decide again if you really 
can allow the user to make this kind of request.  This could also create 
another step in the process to keep track of what images have already been 
displayed so that when the screen comes back to your script you can pick up 
where you left off and display a second page.

THEN you can generate the html to produce a useful page of images.

At least that's how I would approach it. And I'm not an expert but simply a 
guy who has put in about a year's worth of effort into learning enough php 
to actually do something like this already, among other things. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-05 Thread Kirk Bailey

ok.
?php
filelist=inventory all files in directory ./

for file in filelist: // walk a listing of many items
IF filetype in gif, jpg, png {
echo 'img src=./'.file.'P'
// notice that is a 'singlequote' immedately followed by a 
doublequote.

?

Something like this. In python I would write something like:

#!/usr/bin/python
import string, glob
files=glob.glob(./*.*) # files is a 
list variable (a 1 dimensional addressable array)
for file in files: # for 
each cell in files do this doblock:
if str.split(file,'.')[1] in gif,jpg,png): #if the file 
type is in a list of acceptable types,
print 'img src=./'+file+'P'# print out the 
material to return surrounding
 # the 
file name






On 4/5/2012 10:34 PM, Tommy Pham wrote:

On Thu, Apr 5, 2012 at 7:26 PM, Kirk Baileykbai...@howlermonkey.net  wrote:

Now ai am still a novice at p[hp, how can I do this ?


Have you read any book on PHP?  even the official from PHP.net?  Learn
the tool so you know how to use it, efficiently.  Otherwise how do you
know if the tool can do what you want...  What you're asking for ATM
is someone to write the code for you which is not how it works.  You
need to provide some code, or even pseudo code at least...

HTH,
Tommy



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-05 Thread Kirk Bailey

jim, I am a novice at this language as I said.

On 4/5/2012 10:44 PM, Jim Giner wrote:

As Tommy says - you sound like a total new user who doesn't know how to do
it and furthermore doesn't know how many things you are going to have to
pick up just to accomplish this task.

You have to:

determine the folder your script is running from
collect an array of  image file names from that directory
determine the size of each of these images so that you are not building some
html that will try to display an unmanageable amount of data all at once.
You may then have to learn how to create smaller images for your img tags,
which is another learning process in itself
determine how many images you will display and decide again if you really
can allow the user to make this kind of request.  This could also create
another step in the process to keep track of what images have already been
displayed so that when the screen comes back to your script you can pick up
where you left off and display a second page.

THEN you can generate the html to produce a useful page of images.

At least that's how I would approach it. And I'm not an expert but simply a
guy who has put in about a year's worth of effort into learning enough php
to actually do something like this already, among other things.


And were people this nice to you when YOU asked beginner questions?




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] image inventoryer

2012-04-05 Thread Tommy Pham
On Thu, Apr 5, 2012 at 8:02 PM, Kirk Bailey kbai...@howlermonkey.net wrote:

If you don't want to read the manual or a book, you could quickly do
some Google'ing as below:

 ok.
 ?php
 filelist=inventory all files in directory ./

filesystem site:php.net

 for file in filelist: // walk a listing of many items

loop site:php.net

    IF filetype in gif, jpg, png {

condition site:php.net

        echo 'img src=./'.file.'P'
 // notice that is a 'singlequote' immedately followed by a doublequote.
 ?

Or just look at the table of contents in the official manual to see
what PHP has to offer and see what you can do since you already have
some programming experience.


 Something like this. In python I would write something like:

 #!/usr/bin/python
 import string, glob
 files=glob.glob(./*.*)                             # files is a list
 variable (a 1 dimensional addressable array)
 for file in files:                                         # for each cell
 in files do this doblock:
    if str.split(file,'.')[1] in gif,jpg,png): #if the file type is in
 a list of acceptable types,
        print 'img src=./'+file+'P'        # print out the material to
 return surrounding
                                                             # the file name






 On 4/5/2012 10:34 PM, Tommy Pham wrote:

 On Thu, Apr 5, 2012 at 7:26 PM, Kirk Baileykbai...@howlermonkey.net
  wrote:

 Now ai am still a novice at p[hp, how can I do this ?

 Have you read any book on PHP?  even the official from PHP.net?  Learn
 the tool so you know how to use it, efficiently.  Otherwise how do you
 know if the tool can do what you want...  What you're asking for ATM
 is someone to write the code for you which is not how it works.  You
 need to provide some code, or even pseudo code at least...

 HTH,
 Tommy



PS:  don't top post since it's preferred on this list.  You can search
the archive for the discussion about it.

HTH,
Tommy

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php