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" <> "" Then
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".Value)%>" class="image" alt="" /></li>
<%
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".Value)) %>" /></li>
<%
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>
&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%&gt;
&lt;!--#include file="Connections/imgR.asp" --&gt;
&lt;%
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
%&gt;
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%&gt;
&lt;%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="ScriptLibrary/dmxgallery.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div align="center"&gt;
&lt;div class="dmxGallery" id="cssGallery1"&gt;
&lt;ul&gt;&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT Recordset1.EOF))
%&gt;
&lt;li&gt;&lt;img src="uploads/&lt;%=(Recordset1.Fields.Item("img".Value)%&gt;" width="199" height="140" class="image" alt="" /&gt;&lt;/li&gt;
&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="dmxThumbList" id="cssGallery1_thumb"&gt;
&lt;ul&gt;&lt;%
Recordset1.MoveFirst()
While ((Repeat2__numRows &lt;&gt; 0) AND (NOT Recordset1.EOF))
%&gt;
&lt;li&gt;&lt;img src="uploads/thumbs/&lt;%=(Recordset1.Fields.Item("img".Value)%&gt;" width="50" height="35" alt="" /&gt;&lt;/li&gt;
&lt;%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset1.MoveNext()
Wend
%&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
// &lt;![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
}
);
}
);
// ]]&gt;
&lt;/script&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
Recordset1.Close()
Set Recordset1 = Nothing
%&gt;
</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

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>
&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%&gt;
&lt;!--#include file="Connections/test.asp" --&gt;
&lt;%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("width" &lt;&gt; "" Then
Recordset1__MMColParam = Request.QueryString("width"
End If
%&gt;
&lt;%
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
%&gt;
&lt;%
Dim Recordset2__MMColParam
Recordset2__MMColParam = "1"
If (Request.QueryString("width" &lt;&gt; "" Then
Recordset2__MMColParam = Request.QueryString("width"
End If
%&gt;
&lt;%
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
%&gt;
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%&gt;
&lt;%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script src="ScriptLibrary/jquery-latest.pack.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="ScriptLibrary/jquery.mousewheel.pack.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="ScriptLibrary/dmxgallery.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;link href="styles/dmxgallery.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class="dmxGallery" id="cssGallery1"&gt;
&lt;ul&gt;
&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT Recordset1.EOF))
%&gt;
&lt;li&gt;&lt;img src="uploads/&lt;%=(Recordset1.Fields.Item("name".Value)%&gt;" width="199" height="140" class="image" alt="" /&gt;&lt;/li&gt;
&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="dmxThumbList" id="cssGallery1_thumb"&gt;
&lt;ul&gt;
&lt;%
While ((Repeat2__numRows &lt;&gt; 0) AND (NOT Recordset2.EOF))
%&gt;
&lt;li&gt;&lt;img src="uploads/thumbs/&lt;%=(Recordset2.Fields.Item("name".Value)%&gt;" width="50" height="35" alt="" /&gt;&lt;/li&gt;
&lt;%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset2.MoveNext()
Wend
%&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;
// &lt;![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
}
);
}
);
// ]]&gt;
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
Recordset1.Close()
Set Recordset1 = Nothing
%&gt;
&lt;%
Recordset2.Close()
Set Recordset2 = Nothing
%&gt;
</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
-----------------------------------

Reply to this topic