Dodekus Posted August 17, 2008 Share Posted August 17, 2008 Hello. I earlier got a code that makes a list of all swf files in a map. Now I want to do that the link to the swf file should be a image (gif). Here is the source code in the browser that gets generated by the php code: <a href='directory/game.swf'>game.swf</a><br> What I want to do is this: <a href='directory/game.swf'>[b]game.gif[/b]</a><br> Here is the code I have now: <?php $directory = "directory"; $dh =@ opendir($directory); if ($dh) { while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fileInfo = pathinfo("" . $directory . "" . DIRECTORY_SEPARATOR . $file); if ($fileInfo["extension"] === "swf") { echo "<a href='" . $directory . "/" . $file . "'>" . $file . "</a><br>"; } } } } ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted August 17, 2008 Share Posted August 17, 2008 if ($fileInfo["extension"] === "swf") { $basename = basename($file,".swf"); echo "<a href='" . $directory . "/" . $file . "'>" . $basename . ".gif</a><br>"; } Quote Link to comment Share on other sites More sharing options...
Dodekus Posted August 17, 2008 Author Share Posted August 17, 2008 Yes, some small changes and it worked. Well done, thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.