Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / December 2004



Tip: Looking for answers? Try searching our database.

dispay .swf files with <cfoutput>

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newkirk - 29 Dec 2004 22:44 GMT
Hello all!!! I ahve a page that  displays a image or .swf file.  My code below
checks to see if the image is a .swf or not.  If it is it includes the
appropriate code to display the movie.  Well the code below will not display
the movie.  It shows a big white box.  If you right-clck that white box the
'about macromedia Flash 7' info box appears.  The image that is supposed to be
displayed was <cffile> uploaded to the website.  Is <cffile> compatible/able to
transfer .swf files?  below is my code.  Can I do it the way I have with the
<cfoutput>s and all?

<cfset IsFlash=FindNoCase(".swf","#getInfo.Alias#")>
       
       <cfif IsFlash eq 0>
              <CFOUTPUT><img
src="#LCase(getDesc.Description)#/#getInfo.Alias#"></CFOUTPUT>
       <cfelse>
            <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

                codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=6,0,40,0"
                WIDTH="800" HEIGHT="600" id="<CFOUTPUT>#getInfo.Alias#</CFOUTPUT>">

                <PARAM NAME=movie
VALUE="<CFOUTPUT>#LCase(getDesc.Description)#/#getInfo.Alias#</CFOUTPUT>">

                <PARAM NAME=quality VALUE=high>

                <PARAM NAME=bgcolor VALUE=#FFFFFF>

                <EMBED src="/support/flash/ts/documents/myFlashMovie.swf" quality=high
bgcolor=#FFFFFF WIDTH="550" HEIGHT="400"
                    NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
                    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
                </EMBED>

     </OBJECT>
     </cfif>
flashcfm.com - 30 Dec 2004 20:43 GMT
Look at the source code as rendered in the browser and see if you are getting
what you expect. If you are check to see that the file path for the swf matches
up with what you have on your server. It sounds like the code calling the swf
just has the wrong location.
Newkirk - 30 Dec 2004 23:34 GMT
GOT IT!!!! The embed options weren't set the same as <object>. Now I can
upload,drill-down and view image and .swf files.   I'm including the complete
code so if someone else has this question it will be answered in FULL!!!  Thank
you for help as well.  

<!---


********************************************************************************
*************************
            A way to upload,rename,store,retreive,drill-down and display images or
.swf files
                        with the appropriate code to support the files type.

********************************************************************************
*************************

--->

<!---
    This page is a an assembly of code snippets from 3 .cfm templates that
        upload image/swf files,rename,store and provide hyper-link drill down
        pages that display a single image/swf file.
       
    1st page-<UploaderACT.cfm)- The page that provides code to upload file
   
    2nd page-<NextN5.cfm)-This page loops through the pictures in a reltated
                            category.  Uses query record set cfloop to output
                            contents in hyperlink form.  (ex. Gallery.cfm?PicID=12)
                            Code logic is provided to determine if file is .swf or
                            .jpg/.gif file
                           
    3rd page-<Gallery.cfm)-This page is the final part of the data drill down.
                                This page displays the picture contained in the
                                image primary key URL variable that was created
                                when the hyperlink.
--->


--------------------------------------------------------------------------------
------------------------

<!---UploaderACT.cfm--->

  <!---Set variable  to store path to photo--->
<CFSET photoDir = #ExpandPath(newPath)#>

<!---Upload photo--->
    <cffile
        action="upload"
        destination="#photoDir#"
        filefield="FORM.PicFile"
        nameconflict="makeunique" mode="777"
    >
   
    <!---To give the image a truly unique name of create a variable to catch the
date/time on the
            system clock,now this ensures the name is unique here is what the filename
would
            look like....  11291204170438.swf --->
    <CFSET img1= #UserID# & #DateFormat(Now(),"DDMMYY")# &
#TimeFormat(Now(),"HHmmss")#>
   
    <!---now append the date/time stamp created in the image1 variable with a new
variable
            named img that uses the name that was created in the <cffile> upload--->
    <CFSET img=#ListAppend(img1,FILE.ServerFileExt,".")#>
   
    <!---Now rename the image and store it in the appropriate  folder--->
    <CFFILE ACTION="RENAME"
        SOURCE="#photoDir#/#CFFILE.ServerFile#"
        destination="#photoDir#/#img#"
    >

<!---Call function to insert photo into DB and return us the PK of the image
just inserted--->
<CFSET
NewKey=PicAdd(#FORM.PicName#,#FORM.PicCaption#,#FORM.DateAdded#,#FORM.CatID#,#im
g#,#FILE.ServerFileExt#)>

<!---Now call function to insert pic into UserPics tbl. That table matches
pics with users--->
<CFSET inserted=KeyInsert(#NewKey#,#UserID#)>


--------------------------------------------------------------------------------
-------------------

<!---NextN5.cfm--->

<TR>

    <!---Output queryrecordset containing all the images in URL.#x# category--->
    <cfloop query="PicOutPut" startrow="#URL.StartRow#" endrow="#EndRow#">
        <TD align="center">
        <!---We gotta check to see if the file is a image or flash movie
                set a variable and use The FindNoCase() function to search
                the file name for the letter combo of .swf
                If the file does not contain .swf the variable
                will be set to zero
        --->
        <cfset IsFlash=FindNoCase(".swf","#PicOutPut.Alias#")>
       
        <!---If it not a flash file display it as a regular image--->
        <cfif IsFlash eq 0>
            <CFOUTPUT>
                <img src="#CatDesc.Description#/#PicOutPut.Alias#"
            </CFOUTPUT> height="100" width="100">
            <BR>
                <B>TITLE</B>:&nbsp;
                <CFOUTPUT>
                    <a href="Gallery.cfm?PicID=#PicOutPut.PicID#">
                </CFOUTPUT>
                <CFOUTPUT>
                    #PicOutPut.PicName#
                </CFOUTPUT>
                </a>
       
        <!---If its not a movie don't show a thumbnail of the picture include
                a default image that informs the user the file is a movie
        --->       
        <CFELSE>
            <img src="images/Im_A_movie.gif">
            <BR>
                <B>TITLE</B>:&nbsp;
                <CFOUTPUT><a href="Gallery.cfm?PicID=#PicOutPut.PicID#"></CFOUTPUT>
                    <CFOUTPUT>#PicOutPut.PicName#</CFOUTPUT>
                </a>
        </cfif>
        </TD>
        <CFIF CurrentRow MOD 3 EQ 0></TR><TR><TD align="center" colspan="3"><img
src="images/graybar.gif"></TD></TR><TR></CFIF>
    </cfloop>
   

--------------------------------------------------------------------------------
------------------------

<!---Gallery.cfm--->

<!---On this page we run a query on the PicID passed in the URL variable to
obtain
specific info about the image and and using a variable containing that query
result we outout the file. Using a little code logic and we determine
if its a .swf file and if so include the appropriate code to dsplay the file
--->
        <cfset IsFlash=FindNoCase(".swf","#PicOutPut.Alias#")>
 
<cfif IsFlash eq 0>
              <CFOUTPUT><img
src="#LCase(getDesc.Description)#/#getInfo.Alias#"></CFOUTPUT>
       <cfelse>
       
            <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

                codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
b#version=6,0,40,0"
                WIDTH="800" HEIGHT="600" id="<CFOUTPUT>#getInfo.Alias#</CFOUTPUT>">

                <PARAM NAME=movie
VALUE="<CFOUTPUT>#LCase(getDesc.Description)#/#getInfo.Alias#</CFOUTPUT>">

                <PARAM NAME=quality VALUE=high>

                <PARAM NAME=bgcolor VALUE=#FFFFFF>

                <EMBED
src="<CFOUTPUT>#LCase(getDesc.Description)#/#getInfo.Alias#</CFOUTPUT>"
quality=high bgcolor=#FFFFFF WIDTH="800" HEIGHT="600"
                    NAME="<CFOUTPUT>#getInfo.Alias#</CFOUTPUT>" ALIGN=""
TYPE="application/x-shockwave-flash"
                    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
                </EMBED>

     </OBJECT>
   
</cfif>


--------------------------------------------------------------------------------
-----------
There you have it!!! A way to upload,rename,store,retreive,drill-down and
display images or .swf files
with the appropriate code to support the files type.  This is basic code and
can be modified for ease of use
and pesonalization.  If you would like to take a look at the function code
email me at:
sitemanager@blueflydatadesign.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.