Re: image inventoryer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 5, 2012 at 8:02 PM, Kirk Bailey <kbailey@xxxxxxxxxxxxxxxx> 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 Bailey<kbailey@xxxxxxxxxxxxxxxx>
>>  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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux