Results 1 to 3 of 3

Thread: How to toggle with flash swf and jpg image

  1. #1
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default How to toggle with flash swf and jpg image

    hi all

    I have to scripts. One script displays the image and other script displays swf file. But both the image and swf are to displayed at the same location. so i want to toggle them.
    If the user uploads an image then image should displayed as image, else if the user uploads an swf file then the swf file should be displayed.

    here is my script that displays image
    Code:
    <?php
      
    $qry="select * from special_offers where location='right side'";	
    $result = mysql_query($qry);			  
    	if(mysql_num_rows($result)>0)
    	{
    		while($row=mysql_fetch_array($result))
    		{
    			
    		echo "<td>". "<img height=200 width=250 src='uploads/" . $row['offer_image'] . "'/>" . "</td>";
    						
    		}
    	}
    	?>
    Here is my script that displays swf file
    Code:
    <?php
      
    $qry="select * from special_offers where location='right side'";	
    $result = mysql_query($qry);			  
    	if(mysql_num_rows($result)>0)
    	{
    		while($row=mysql_fetch_array($result))
    		{
    			
    		echo "<td>"; 
    		echo "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='250' height='200'>";
      echo "<param name='movie' value='uploads/" . $row['offer_image'] ."'/>";
      echo "<param name='quality' value='high' />";
      echo "<embed quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer'   type='application/x-shockwave-flash' width='250' height='200'  src='uploads/" . $row['offer_image']."'>" . "</embed>";
    echo "</object>";
    		echo "</td>";
    		
    		}
    	}
    	
    		
    	?>
    how can i toggle them. i dont want to detect flash player. just display the image or swf according to the user input.

    vineet

  2. #2
    Join Date
    Sep 2008
    Posts
    56
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re: - How to toggle with flash swf and jpg image

    Hi,

    Since you have name of the image or flash to be displayed stored in the database, thus just before displaying the same check for the extension (last four characters from string with name of media to be displayed), check if the extension is .gif or .jpg then use img src for showing the image and if its .swf then use the object tag to show it.

    Hope it makes sense!

    Cheers,

    ~Maneet
    LeXolution IT Services
    Web Development Company

  3. #3
    Join Date
    Jun 2008
    Posts
    121
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default how to toggle with flash and jpg image

    Quote Originally Posted by maneetpuri View Post
    Hi,

    Since you have name of the image or flash to be displayed stored in the database, thus just before displaying the same check for the extension (last four characters from string with name of media to be displayed), check if the extension is .gif or .jpg then use img src for showing the image and if its .swf then use the object tag to show it.

    Hope it makes sense!

    Cheers,

    ~Maneet
    LeXolution IT Services
    Web Development Company
    hi maneet

    thanks for the reply. can u send me some code idea or example to check extension.

    or will it be done with
    Code:
    <?php
    if($_FILES['filename']['type'] == "images/gif")
    	  {
    echo "<td>". "<img height=200 width=250 src='uploads/" . $row['offer_image'] . "'/>" . "</td>";
    }
    else
    {
    echo flash code
    }
    ?>
    vineet

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •