kd83 Posted April 27, 2006 Share Posted April 27, 2006 Here is a copy of my code...<?phpprint ("<link href='style.css' rel='stylesheet' type='text/css'>");//-- User Configured Data$current_dir = 'images/press';//-- Read the directory and display the results.$dir = opendir($current_dir);print( "<table height=350 id='middleRow' cellspacing=5 cellpadding=5 border=0><tr>");while ( $f = readdir($dir) ) { $ext = substr($f,-4); if ( $ext == ".jpg" ){ $pf = explode('.',$f); print ("<td height=350 valign=middle><a href='/pdfs/" . $pf[0]. ".pdf' target='_blank'>"); print ("<img src='/images/press/" . $f ."' width=210 height=225 border=0 /></a></td>"); } }closedir( $dir );print ("</tr></table>");?>Right now, this program grabs appropriately named gifs and lines them up with their couterpart PDF. The lady who I work for now wants to put up an image that links up 2 video links. Logistically it makes sense to link up the new images to create another page and place my video options there. Unfortunately, I am not very experienced with PHP and I am not the original designer, so I am seeking some advice. How can I add a link to the latest image that isn't a pdf and is rather a link to another page?Thanks everyone!Kristin Link to comment https://forums.phpfreaks.com/topic/8571-adding-file-types-for-display/ Share on other sites More sharing options...
kd83 Posted April 28, 2006 Author Share Posted April 28, 2006 Hey Everyone, I thought I'd update incase anyone else wants to do this...actually it was really easy to modify, I just had to think about it a lot.[!--coloro:#333399--][span style=\"color:#333399\"][!--/coloro--]<?phpprint ("<link href='style.css' rel='stylesheet' type='text/css'>");//-- Array definitions$current_dir = 'images/press';$files = array();$pf = array();$pdf = array();//-- Read the directory and display the results.$dir = opendir($current_dir);while ( $f = readdir($dir) ) { $ext = substr($f,-4); //searches for specific extentions and adds the files to the arrays. if you want to add a new extention, just type or $ext == ".whateverextention" inside the () if ( $ext == ".pdf" or $ext == ".mov" or $ext == ".wmv" ){ //f=extention $pf = explode('.',$f); //files=full file name $files[] = $f; //pdf=filename = extention $pdf[] = $pf[0]; } }closedir( $dir );//sorts by filename numericallyrsort($pdf);rsort($files);print( "<table height=350 id='middleRow' cellspacing=5 cellpadding=5 border=0><tr>");for ($i = 0; $i < count($files); $i++){ //references(prints) the link to the full file print ("<td height=350 valign=middle><a href='/images/press/" . $files[$i]. "' target='_blank'>"); //prints the thumbnail print ("<img src='/images/press/thumbs/" . $pdf[$i] .".gif' border=0 /></a></td>");}print ("</tr></table>");?>[!--colorc--][/span][!--/colorc--] Link to comment https://forums.phpfreaks.com/topic/8571-adding-file-types-for-display/#findComment-31549 Share on other sites More sharing options...
.josh Posted April 28, 2006 Share Posted April 28, 2006 good job m8 Link to comment https://forums.phpfreaks.com/topic/8571-adding-file-types-for-display/#findComment-31555 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.