View previous topic :: View next topic |
Author |
Message |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Mon Jan 02, 2012 6:11 am Post subject: Automatic embed all images? |
|
|
Is it possible to make a page that automatically embeds all images in its directory?
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 204
Joined: 25 Jan 2006 Posts: 8580 Location: 127.0.0.1
|
Posted: Mon Jan 02, 2012 9:03 pm Post subject: |
|
|
Using php:
Code: |
<?php
$AllowedFileTypes = array( 'png', 'jpg' );
if( $dirHandle = opendir( '.' ) )
{
while( ( $entry = readdir( $dirHandle ) ) !== false )
{
if( $entry == "." || $entry == ".." || is_dir( $entry ) )
continue;
$fileInfo = pathinfo( $entry );
if( in_array( $fileInfo['extension'], $AllowedFileTypes ) )
{
echo "<img src=\"{$entry}\" alt=\"{$entry}\" />";
}
}
closedir( $dirHandle );
}
?>
|
_________________
- Retired. |
|
Back to top |
|
 |
Cryoma Member of the Year
Reputation: 198
Joined: 14 Jan 2009 Posts: 1819
|
Posted: Mon Jan 02, 2012 10:54 pm Post subject: |
|
|
Flawless thank you.
|
|
Back to top |
|
 |
saqlain1122 How do I cheat?
Reputation: 0
Joined: 05 Sep 2014 Posts: 1
|
Posted: Fri Sep 05, 2014 7:48 am Post subject: Sm |
|
|
s it possible to make a page that automatically embeds all images in its directory?
_________________
saqlain1122 |
|
Back to top |
|
 |
|