sGaleriaAlt = Server.HTMLEncode(directorio_producto & " " & rs_partnumber)
sGaleriaUrlPrincipal = Trim("" & url_imagen)
sGaleriaMiniaturas = ""
iGaleriaTotal = 0
Set rsGaleriaProducto = Server.CreateObject("ADODB.Recordset")
rsGaleriaProducto.ActiveConnection = MM_dbai_STRING
sSQL = "SELECT " & _
"\tp.ImageID, " & _
"\tp.ContentGuid, " & _
"\tp.URL, " & _
"\tCOALESCE(p.ImageWeight, 0) AS ImageWeight, " & _
"\tCOALESCE(p.ImageWidth, 0) AS ImageWidth " & _
"FROM " & _
"\tproductos_fotos p " & _
"\tLEFT JOIN productos_fotos p2 " & _
"\t\tON p.Codigo = p2.Codigo " & _
"\t\tAND p.ImageID = p2.ImageID " & _
"\t\tAND COALESCE(p2.Activa, 1) = 1 " & _
"\t\tAND (" & _
"\t\t\tCOALESCE(p2.ImageWeight, 0) > COALESCE(p.ImageWeight, 0) " & _
"\t\t\tOR (COALESCE(p2.ImageWeight, 0) = COALESCE(p.ImageWeight, 0) AND COALESCE(p2.ImageWidth, 0) > COALESCE(p.ImageWidth, 0)) " & _
"\t\t\tOR (COALESCE(p2.ImageWeight, 0) = COALESCE(p.ImageWeight, 0) AND COALESCE(p2.ImageWidth, 0) = COALESCE(p.ImageWidth, 0) AND p2.ContentGuid > p.ContentGuid)" & _
"\t\t) " & _
"WHERE " & _
"\tp.Codigo = " & rs_codigo & " " & _
"\tAND COALESCE(p.Activa, 1) = 1 " & _
"\tAND p2.ImageID IS NULL " & _
"ORDER BY " & _
"\tCOALESCE(p.ImageWeight, 0) DESC, " & _
"\tCOALESCE(p.ImageWidth, 0) DESC, " & _
"\tp.ImageID"
rsGaleriaProducto.Source = sSQL
rsGaleriaProducto.CursorType = 0
rsGaleriaProducto.CursorLocation = 2
rsGaleriaProducto.LockType = 1
rsGaleriaProducto.Open()
If Not rsGaleriaProducto.Eof Then
While Not rsGaleriaProducto.Eof
sGaleriaUrlItem = Trim("" & rsGaleriaProducto("URL"))
If Len(sGaleriaUrlItem) > 0 Then
sGaleriaUrlItem = Replace(sGaleriaUrlItem, "http://", "https://")
iGaleriaTotal = iGaleriaTotal + 1
If iGaleriaTotal = 1 Then
sGaleriaUrlPrincipal = sGaleriaUrlItem
sGaleriaCssActiva = " Activa"
Else
sGaleriaCssActiva = ""
End If
sGaleriaMiniaturas = sGaleriaMiniaturas & _
"
"
End If
rsGaleriaProducto.MoveNext()
Wend
End If
rsGaleriaProducto.Close()
Set rsGaleriaProducto = Nothing
If iGaleriaTotal = 0 Then
iGaleriaTotal = 1
sGaleriaMiniaturas = "
"
End If
%>
1/