CSS Image Gallery Support Product Page
This topic was archived
Problems Dynamically Settinging Images
Asked 08 Aug 2008 23:26:07
1
has this question
08 Aug 2008 23:26:07 Greg Kresslein posted:
I've followed the tutorial (www.dmxzone.com/showDetail.asp?TypeId=7&NewsId=14424) and done research on repeat regions, but I can't get two repeat regions to work on my Gallery Page. The main photos will scroll, pulling the images from the DB, but the thumbnails will not. I have added rsGallery.MoveFirst() in my code, but when I do, ALL of the main photos simply repeat down the page with a bullet next to them. I seems so simple, but obviously I'm doing something completely wrong. Here is my code:<%
Dim rsGallery__MMColParam
rsGallery__MMColParam = "Y"
If (Request("MM_EmptyValue"


rsGallery__MMColParam = Request("MM_EmptyValue"

End If
%>
<%
Dim rsGallery
Dim rsGallery_cmd
Dim rsGallery_numRows
Set rsGallery_cmd = Server.CreateObject ("ADODB.Command"

rsGallery_cmd.ActiveConnection = MM_rhine_STRING
rsGallery_cmd.CommandText = "SELECT * FROM photos WHERE patios = ?"
rsGallery_cmd.Prepared = true
rsGallery_cmd.Parameters.Append rsGallery_cmd.CreateParameter("param1", 200, 1, 200, rsGallery__MMColParam) ' adVarChar
Set rsGallery = rsGallery_cmd.Execute
rsGallery_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsGallery_numRows = rsGallery_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
rsGallery_numRows = rsGallery_numRows + Repeat2__numRows
%>
<div class="dmxGallery" id="cssGallery1">
<ul>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsGallery.EOF))
%>
<li><img src="/photos/<%=(rsGallery.Fields.Item("mainphoto"

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsGallery.MoveNext()
Wend
%>
</ul>
</div>
<div class="dmxThumbList" id="cssGallery1_thumb">
<ul>
<%
rsGallery.MoveFirst()
While ((Repeat2__numRows <> 0) AND (NOT rsGallery.EOF))
%>
<li><img src="/photos/<%= Thumbnail("_small",(rsGallery.Fields.Item("mainphoto"

<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsGallery.MoveNext()
Wend
%>
</ul>
</div>
Replies
Replied 11 Aug 2008 11:08:34
11 Aug 2008 11:08:34 Miroslav Zografski replied:
Hi Greg,
Is it necessary to have tumbs and origins in same folder? Otherwise if you specify everithing as it is shown in tutorial it will be ok.
Like this:
<pre id=code><font face=courier size=2 id=code>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/imgR.asp" -->
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command"
Recordset1_cmd.ActiveConnection = MM_imgR_STRING
Recordset1_cmd.CommandText = "SELECT * FROM cssdynamic.dynaimc"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/dmxgallery.js" type="text/javascript"></script>
<link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
<div class="dmxGallery" id="cssGallery1">
<ul><%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/<%=(Recordset1.Fields.Item("img"
.Value)%>" width="199" height="140" class="image" alt="" /></li>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<div class="dmxThumbList" id="cssGallery1_thumb">
<ul><%
Recordset1.MoveFirst()
While ((Repeat2__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/thumbs/<%=(Recordset1.Fields.Item("img"
.Value)%>" width="50" height="35" alt="" /></li>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#cssGallery1"
.dmxGallery(
{
width: 304,
height: 140,
thumbWidth: 95,
thumbHeight: 80,
thumbPadding: 5,
thumbHolderHeight: 80,
thumbHolderPosition: 'right',
thumbShowOnHover: false,
captionPosition: 'top',
playerDelay: 3,
autoPlay: false,
autosize: true,
captionOpacity: 40,
imgIndex: 0,
preloadTreshold: 2,
currentImage: 0
}
);
}
);
// ]]>
</script>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
</font id=code></pre id=code>
Regrads,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------
Is it necessary to have tumbs and origins in same folder? Otherwise if you specify everithing as it is shown in tutorial it will be ok.
Like this:
<pre id=code><font face=courier size=2 id=code>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/imgR.asp" -->
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command"

Recordset1_cmd.ActiveConnection = MM_imgR_STRING
Recordset1_cmd.CommandText = "SELECT * FROM cssdynamic.dynaimc"
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/dmxgallery.js" type="text/javascript"></script>
<link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">
<div class="dmxGallery" id="cssGallery1">
<ul><%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/<%=(Recordset1.Fields.Item("img"

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<div class="dmxThumbList" id="cssGallery1_thumb">
<ul><%
Recordset1.MoveFirst()
While ((Repeat2__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/thumbs/<%=(Recordset1.Fields.Item("img"

<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<script type="text/javascript">
// <
{
width: 304,
height: 140,
thumbWidth: 95,
thumbHeight: 80,
thumbPadding: 5,
thumbHolderHeight: 80,
thumbHolderPosition: 'right',
thumbShowOnHover: false,
captionPosition: 'top',
playerDelay: 3,
autoPlay: false,
autosize: true,
captionOpacity: 40,
imgIndex: 0,
preloadTreshold: 2,
currentImage: 0
}
);
}
);
// ]]>
</script>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
</font id=code></pre id=code>
Regrads,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 11 Aug 2008 17:01:48
11 Aug 2008 17:01:48 Greg Kresslein replied:
Miroslav
Thanks for the post. I figured out what was going on. My recordset had a filter variable defined. As soon as I removed it, the gallery works fine. The problem is, I need to filter the recordset so that it only shows the photos based on fields in the database. Any suggestions?
Thanks.
Greg
Thanks for the post. I figured out what was going on. My recordset had a filter variable defined. As soon as I removed it, the gallery works fine. The problem is, I need to filter the recordset so that it only shows the photos based on fields in the database. Any suggestions?
Thanks.
Greg
Replied 11 Aug 2008 17:30:54
11 Aug 2008 17:30:54 Miroslav Zografski replied:
Hi Greg,
So I assume you have a field witch sets group of images and you need to filter images on this field. So I did a page witch gallery was with filtered recordset buy the width of the images. I created second recordset for thumbnails from same table with same filter - URL parameter. And it works
just fine. Database is Access, nut I guess it will work with SQL as good as with this one. Here is the code:
<pre id=code><font face=courier size=2 id=code>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/test.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("width"
<> ""
Then
Recordset1__MMColParam = Request.QueryString("width"
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command"
Recordset1_cmd.ActiveConnection = MM_test_STRING
Recordset1_cmd.CommandText = "SELECT * FROM Table1 WHERE width = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("width"
<> ""
Then
Recordset2__MMColParam = Request.QueryString("width"
End If
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command"
Recordset2_cmd.ActiveConnection = MM_test_STRING
Recordset2_cmd.CommandText = "SELECT * FROM Table1 WHERE width = ?"
Recordset2_cmd.Prepared = true
Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 5, 1, -1, Recordset2__MMColParam) ' adDouble
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/dmxgallery.js" type="text/javascript"></script>
<link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="dmxGallery" id="cssGallery1">
<ul>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/<%=(Recordset1.Fields.Item("name"
.Value)%>" width="199" height="140" class="image" alt="" /></li>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<div class="dmxThumbList" id="cssGallery1_thumb">
<ul>
<%
While ((Repeat2__numRows <> 0) AND (NOT Recordset2.EOF))
%>
<li><img src="uploads/thumbs/<%=(Recordset2.Fields.Item("name"
.Value)%>" width="50" height="35" alt="" /></li>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset2.MoveNext()
Wend
%>
</ul>
</div>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function()
{
jQuery("#cssGallery1"
.dmxGallery(
{
width: 304,
height: 140,
thumbWidth: 95,
thumbHeight: 80,
thumbPadding: 5,
thumbHolderHeight: 80,
thumbHolderPosition: 'right',
thumbShowOnHover: false,
captionPosition: 'top',
playerDelay: 3,
autoPlay: false,
autosize: true,
captionOpacity: 40,
imgIndex: 0,
preloadTreshold: 2,
currentImage: 0
}
);
}
);
// ]]>
</script>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
</font id=code></pre id=code>
Regards,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------
So I assume you have a field witch sets group of images and you need to filter images on this field. So I did a page witch gallery was with filtered recordset buy the width of the images. I created second recordset for thumbnails from same table with same filter - URL parameter. And it works
just fine. Database is Access, nut I guess it will work with SQL as good as with this one. Here is the code:
<pre id=code><font face=courier size=2 id=code>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/test.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("width"


Recordset1__MMColParam = Request.QueryString("width"

End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command"

Recordset1_cmd.ActiveConnection = MM_test_STRING
Recordset1_cmd.CommandText = "SELECT * FROM Table1 WHERE width = ?"
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 5, 1, -1, Recordset1__MMColParam) ' adDouble
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
<%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("width"


Recordset2__MMColParam = Request.QueryString("width"

End If
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command"

Recordset2_cmd.ActiveConnection = MM_test_STRING
Recordset2_cmd.CommandText = "SELECT * FROM Table1 WHERE width = ?"
Recordset2_cmd.Prepared = true
Recordset2_cmd.Parameters.Append Recordset2_cmd.CreateParameter("param1", 5, 1, -1, Recordset2__MMColParam) ' adDouble
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"></script>
<script src="ScriptLibrary/dmxgallery.js" type="text/javascript"></script>
<link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="dmxGallery" id="cssGallery1">
<ul>
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<li><img src="uploads/<%=(Recordset1.Fields.Item("name"

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</ul>
</div>
<div class="dmxThumbList" id="cssGallery1_thumb">
<ul>
<%
While ((Repeat2__numRows <> 0) AND (NOT Recordset2.EOF))
%>
<li><img src="uploads/thumbs/<%=(Recordset2.Fields.Item("name"

<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset2.MoveNext()
Wend
%>
</ul>
</div>
<script type="text/javascript">
// <
{
width: 304,
height: 140,
thumbWidth: 95,
thumbHeight: 80,
thumbPadding: 5,
thumbHolderHeight: 80,
thumbHolderPosition: 'right',
thumbShowOnHover: false,
captionPosition: 'top',
playerDelay: 3,
autoPlay: false,
autosize: true,
captionOpacity: 40,
imgIndex: 0,
preloadTreshold: 2,
currentImage: 0
}
);
}
);
// ]]>
</script>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Recordset2.Close()
Set Recordset2 = Nothing
%>
</font id=code></pre id=code>
Regards,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 11 Aug 2008 17:36:09
11 Aug 2008 17:36:09 Greg Kresslein replied:
I had it working originally with two Recordsets, I was just hoping there was a cleaner way to do it using only one RS. I'm assuming from your response that there is not. Thanks.
Replied 11 Aug 2008 18:13:27
11 Aug 2008 18:13:27 Miroslav Zografski replied:
Hi Greg,
Well, it is so. Maybe there is a way that I'm not aware of. I can check it, but it will take some time.
Regards,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------
Well, it is so. Maybe there is a way that I'm not aware of. I can check it, but it will take some time.
Regards,
M.Zografski
-----------------------------------
DMXZone.com Support Team
-----------------------------------