Can 3D Flow Gallery work with dynamic images from a recordset (PHP/MySQL)?
Can 3D Flow Gallery work with dynamic images from a recordset (PHP/MySQL)? Answer:
Currently the interface of the extension does not allow to select Database as a source of image information.
However, 3D Flow Gallery reads the information of the gallery and the images from xml file.
1. While creating your gallery, just insert one file into it - we will use this as a dummy image.
2. Next open your XML file - it should be located in your siteroot/imageflowgallery. Save it as a new PHP file, i.e. change the extension from XML to PHP. Do not forget that you will need to change a couple of attributes into your html file.
<param name="FlashVars" value="xmlFile=yoursite_root/imageflowgallery/3DFlowGallery1.xml" />
to
<param name="FlashVars" value="xmlFile=yoursite_root/imageflowgallery/3DFlowGallery1.php" />
and the following attribute from:
flashvars="xmlFile=yoursite_root/imageflowgallery/3DFlowGallery1.xml"
to
flashvars="xmlFile=yoursite_root/imageflowgallery/3DFlowGallery1.php"
3. Insert a recordset from Dreamweaver into your PHP file (XML which extension you have just changed) and select your database where you want to insert images from.
4. In your PHP file you should notice the following line:
<img url="MyDummyPicture" target="_blank" alt="" /><br />
Change MyDummyPicture with the following code:
<?php echo $row_rsImages['image']; //image is a column in my database for the image path ?>
So now you will want to display all images from your database. In order to do that you will need to use repeat region for your image, i.e.:
<?php do { ?>
<img url="<?php echo $row_rsImages['image']; ?>" target="_blank" alt="" /><![CDATA[]]></image>
<?php } while ($row_rsImages = mysql_fetch_assoc($rsImages)); ?>
NOTE: I am using database with 2 columns - "ID" for the key and "image" for the image path.
For more info you can check the movie on the official page of the extension here.
DISCLAIMER:
This is extra complimentary content which purpose is to show additional usage that is not part of the product, i.e. it suggests tips for extending the functionality of the product by the users themselves.
It is provided "as is", without warranty of any kind, express or
implied , including but not limited to the warranties of
merchantability, fitness for a particular purpose and nonfringement of
third party rights.
DMXzone does not take responsibility to
support the suggested content to be fully compatible and working as
intended and does not provide support for extended functionality which
is not included in the current release of the extension.
It is highly recommended that only more advanced developers use it.
Comments
ASP as well
Thanks for that, that was a great help. Here is an example of retrieving the records from a database using ASP.
<%@LANGUAGE="VBSCRIPT"%>
Its just an example you will have to change the database connections and the database field names but you get my meaning by it.<!--#include file="../Connections/mydns.asp" -->
<%
Dim myimages__MMColParam
myimages__MMColParam = "1"
If (Request.QueryString("category") <> "") Then
myimages__MMColParam = Request.QueryString("category")
End If
%>
<%
Dim myimages
Dim myimages_cmd
Dim myimages_numRows
Set myimages_cmd = Server.CreateObject ("ADODB.Command")
myimages_cmd.ActiveConnection = MM_mydns_STRING
myimages_cmd.CommandText = "SELECT * FROM myimages WHERE category = ?"
myimages_cmd.Prepared = true
myimages_cmd.Parameters.Append myimages_cmd.CreateParameter("param1", 5, 1, -1, myimages__MMColParam) ' adDouble
Set myimages = myimages_cmd.Execute
myimages_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
myimages_numRows = myimages_numRows + Repeat1__numRows
%>
<imageflow
autoFlip="true"
flipInterval="3"
flipSpeed="4"
useMotionBlur="true"
dofStrength="2"
angle="56"
depth="734"
spaceMain="156"
spaceBack="104"
descColor="0xAAAAAA"
descSize="12"
hasReflection="true"
reflectionStrength="60"
reflectionSize="30"
reflectionBackground="000000"
startImage="0"
imgWidth="266"
imgHeight="146"
quality="1"
fogStrength="40">
<title color="0xAAAAAA" size="12"><![CDATA[Your gallery title here]]></title>
<%
While ((Repeat1__numRows <> 0) AND (NOT myimages.EOF))
%>
<image url="mypics/<%=(myimages.Fields.Item("myimage_pic").Value)%>" target="_blank" width="450" height="200"><![CDATA[<%=(myimages.Fields.Item("myimage_title").Value)%>]]></image>
<%
repeat1__index="Repeat1__index+1"
repeat1__numrows="Repeat1__numRows-1"
myimages.MoveNext()
Wend
%>
</imageflow>
<%
myimages.Close()
Set myimages = Nothing
%>
You must me logged in to write a comment.