Re: image inventoryer

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

 



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


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