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>"; } } } } ?> Link to comment https://forums.phpfreaks.com/topic/120051-solved-check-gif-names-from-swf/ 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>"; } Link to comment https://forums.phpfreaks.com/topic/120051-solved-check-gif-names-from-swf/#findComment-618412 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. Link to comment https://forums.phpfreaks.com/topic/120051-solved-check-gif-names-from-swf/#findComment-618426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.