Thumbnail fra den tilhørende kategori.
Er i færd med at "ombygge" et gammel galleri (DuGallery).På forsiden er der normalt kun tekst links til de forskellige kategorier, samt optælling af antal billeder i hver kategori.
Har lavet en ændring, (med lidt fusk) så der vises thumbnail sammen med linket, men det virker ikke helt perfekt, samme billede ved alle link, så billedet tilhører kun korrekt kategori ved et link.
Vil have lavet så der vises en thumbnail fra den korrekte kategori (gerne random), men kan ikke finde ud af syntax.
Siden kan ses her http://www.rodeorm.dk/gal/gal_default.asp
Her er koden til siden.
<!--#include file="Connections/connDUgallery.asp" -->
<%
set rsTypes = Server.CreateObject("ADODB.Recordset")
rsTypes.ActiveConnection = MM_connDUgallery_STRING
rsTypes.Source = "SELECT *, (SELECT COUNT(*) FROM PICTURES WHERE PIC_TYPE = TYPE_ID) AS PIC_COUNT FROM TYPES ORDER BY TYPE_ID DESC "
rsTypes.CursorType = 0
rsTypes.CursorLocation = 2
rsTypes.LockType = 3
rsTypes.Open()
rsTypes_numRows = 0
%>
<%
Dim HLooper1__numRows
HLooper1__numRows = -2
Dim HLooper1__index
HLooper1__index = 0
rsTypes_numRows = rsTypes_numRows + HLooper1__numRows
%>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("./../../../database/vega/DUgallery.mdb")
Conn.Open DSN
strSQL = "SELECT * FROM PICTURES PIC_IMAGE"
Set rs = Conn.Execute(strSQL)
rs.Move rndNumber 'Flyt til den valgte record
%>
<div class = "links">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
<tr>
<td align="center" valign="middle"> <table width="98%" cellpadding="10" cellspacing="2">
<%
startrw = 0
endrw = HLooper1__index
numberColumns = 3
numrows = -1
while((numrows <> 0) AND (Not rsTypes.EOF))
startrw = endrw + 1
endrw = endrw + numberColumns
%>
<tr align="center" valign="top">
<%
While ((startrw <= endrw) AND (Not rsTypes.EOF))
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function Thumbnail(tmb_suff,tmb_filename)
Dim tmb_NewFilename, tmb_Path, tmb_PosPath, tmb_PosExt
if not isnull(tmb_filename) then
tmb_PosPath = InStrRev(tmb_filename,"/")
tmb_Path = ""
if tmb_PosPath > 0 then
tmb_Path = mid(tmb_filename,1,tmb_PosPath)
end if
tmb_PosExt = InStrRev(tmb_filename,".")
if tmb_PosExt > 0 then
tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,tmb_PosExt-(tmb_PosPath+1)) & tmb_suff & ".jpg"
else
tmb_NewFilename = tmb_Path & mid(tmb_filename,tmb_PosPath+1,len(tmb_filename)-tmb_PosPath) & tmb_suff & ".jpg"
end if
end if
Thumbnail = tmb_NewFilename
end function
</SCRIPT>
<td>
<table width="235" height="235" style="border-width:2px;border-color:silver; border-bottom-color:red; border-left-color:red;border-style:dotted dotted solid solid;"
cellspacing="0" cellpadding="8">
<tr align="left" valign="middle">
<td width="22">
</td>
<td class="textBold"><font face="Verdana, Arial, Helvetica, sans-serif" size="3">
<a href="type.asp?iType=<%=(rsTypes.Fields.Item("TYPE_ID").Value)%>">
<img src="images/<%= Thumbnail("_small",(rs("PIC_IMAGE").Value)) %>" border="0"><br><br>
<%=(rsTypes.Fields.Item("TYPE_NAME").Value)%></a> </font> </td>
</tr>
<tr align="left" >
<td> </td>
<td class="textGray">
<i><%=(rsTypes.Fields.Item("TYPE_DESCRIPTION").Value)%></i><br><br>
<div style="text-align:right">
<%=(rsTypes.Fields.Item("MAANED").Value)%><br>
<font face="Verdana, Arial, Helvetica, sans-serif" size="-2">
<%=(rsTypes.Fields.Item("PIC_COUNT").Value)%> Billeder.</font>
</div>
</td>
</tr>
</table></td>
<%
startrw = startrw + 1
rsTypes.MoveNext()
Wend
%>
</tr>
<%
numrows=numrows-1
Wend
%>
</td>
</tr>
</table>
</div>
<%
rsTypes.Close()
%>