You are here: Re: My readdir and display images snippet - Thanks « PHP Programming Language « IT news, forums, messages
Re: My readdir and display images snippet - Thanks

Posted by Confused but working on it on 09/14/07 21:42

On 2007-09-13 08:10:48 -0700, Captain Paralytic <paul_lautman@yahoo.com> said:

> On 12 Sep, 17:50, Confused but working on it
> <PostInGro...@wherever.com> wrote:
>> Just wanted to say thanks for the posts helping me make ths work. Added
>> a few comments and after the readdir used a pattern match to test for
>> .jpg, and seems to work fine on my test setup. Maybe I should test for
>> gif, tiff, and png... Anyway, here's the code:
>> <?php
>> //Open images directory
>> $dir = opendir("images");
>> //read files in the dir
>> while (($file = readdir($dir)) !== false)
>> //test to make sure jpg
>> if (eregi("\.jpg",$file))
>> {
>> echo "<img src='images/$file' class=\"pad1em\">";
>> }
>> closedir($dir);
>> ?>
>>
>> For my next trick I'm going to change the above to read a thumbs dir,
>> and make a link to a larger picture of the same name in images.
>> Shouldn't be too hard bt my last programming class was almost 20 years
>> ago. :) Hats off to everyone that does this for a living.
>>
>> Thanks again!
>
> I think that your ereg might find files such as fred.jpgs.php

Yo Captain! (ex-nick of mine)

So that will never be found because fred and I, well, his wife will
tell you the whole story...

Just like a million other peeps I take pictures. I load em up in my mac
in iPhoto, make an album with the corresponding name and don't include
shats that were crappy. Export to a dir called images, filezilla to my
site. Use my little code to display on a page. I tried iWeb to make
pages, gallery databases done in php, and holy cow way to complicated.
Just easier to manage everything in directories by some kind of topic.

So is there a way for your exampe to happen?

Thanks for your input,
Ron

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация