You are here: Re: showing images from a directory « PHP Programming Language « IT news, forums, messages
Re: showing images from a directory

Posted by juglesh on 10/17/62 11:34

patrick_woflian wrote:
> hey guys. okay... this may seem confussing to you but im in desperate
> need of help!! basically i have a list of images in a directory called
> 'pictures'.. and i was hoping to show them on a web page by the
> following code:

You gots to look at the html that is produced by this code, and see if
it makes sense:
> <?php
>
> $handle = opendir('pictures');
>
> if($handle) {
>
> while(false !== ($file = readdir($handle))) {
>
> if(preg_match("/\w+(.jpg)/",$file)) {
>
> print"<a href='pictures'>"$file"</a>";

So where is this link supposed to go? Maybe you wanted "<a
href='pictures.htm'>"?
>
>
> print "$file <br>";

Did you want this to print the actual image, or just the name of it?
If you want to see the image, you would do like:
print "<img src='myImageDir/$file'>";

--
juglesh

 

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

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