Jump to content

Display a SWF


SleepTight

Recommended Posts

Hello. I am not entirely certain if this is even possible, but I don't see why it wouldn't.

 

 

The document that I have is:

<?php 
include('../connection.php'); 
$query="SELECT * FROM projects";
$result=mysql_query($query); 
                          
        echo "<table border='1' cellpadding='10'>";  
      
        while($row = mysql_fetch_array( $result )) { 
                 
           
                echo "<tr>"; 
                echo "<td>$row[id]</td>"; 
                echo "<td>$row[name]</td>"; 
                echo "<td>$row[text]</td>";  
			echo "<td><img src='../uploads/$row[image]'/></td>";
                echo "<td><a href='editprojects.php?id=$row[id]'>Edit</a></td>"; 
                echo "<td><a href='deleteprojects.php?id=$row[id]'>Delete</a></td>"; 
                echo "</tr>";  
        }  
        echo "</table>"; 
	mysql_free_result($result);
	mysql_close($connection);
?> 

 

 

 

Basically, the only important line from that file is:

		echo "<td><img src='../uploads/$row[image]'/></td>";

 

What I am doing is uploading images and other files to a PHP database.

 

[image] = carries all the uploaded files.

 

That single line shows every uploaded image in a row. But it doesn't show the SWF because obviously 'img src' isn't for swf's.

 

Is it possible to add another code to THAT LINE to show the swf's? that single bit needs to be able to read images and swf's,

 

 

Please help if you can.

 

Link to comment
Share on other sites

Well you can simply test whether its an SWF or not, and if it use embed code instead of img src, example:

function getFileExt($filename)
{
	$fileExt = strrpos($filename, ".");
	$fileExt = substr($filename, $fileExt+1, strlen($filename)-$fileExt);
	return $fileExt;
}

 

Then in your code you can use something like:

if (getFileExt($row[image])==swf) {
echo "<td>embed blah blah .swf</td>";} else {
echo "<td><img src='../uploads/$row[image]'/></td>";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.