Random Display Of Images
I am trying to retrieve images from the database and display them in a random order. The order of the images is supposed to change each time page is refreshed. Below is my code, I am using an array to store the images but the images are not displayed for some reason. Code:
View Replies
ADVERTISEMENT
I am trying to retrieve images from the database and display them in a random order. The order of the images is supposed to change each time page is refreshed.
Below is my code, I am using an array to store the images but the images are not displayed for some reason. Any help would be appreciated.
<% Dim rstResult
Dim strSQL
Dim img(100)
imgID = 0
set rstResult = Server.CreateObject("ADODB.Recordset")
strSQL = "sp_sel_TilesByType 'O'"
rstResult.Open strSQL, strConnect
set rResult = Server.CreateObject("ADODB.Recordset")
sSQL = "sp_sel_TilesByType 'O'"
rResult.Open sSQL, strConnect
if not rResult.EOF then
do while not rResult.EOF
response.write("hi")
imgID = imgID + 1
img(imgID) = "images/tiles/" & rResult("TileImage")
response.write(img(imgID))
rResult.movenext
loop
end if
if not rstResult.EOF then
intVendorID = 0
do while not rstResult.EOF
if intVendorID <> rstResult("VendorID") then
rndNumber = RandomNumber(imgID)
Response.Write "<p>"
Response.Write "<a href=javascript:popWin('tileview.asp?" & rstResult("TileID") & "','',1,1,1,1,700,600);>"
'Response.Write "<img src=images/tiles/" & rstResult("TileImage") & " border=0>"
response.write(rndnumber)
Response.write "<img src=img(rndNumber)>"
Response.Write "</a>"
Response.Write "</p>"
end if
intVendorID = rstResult("VendorID")
rstResult.MoveNext
loop
end if
set rstResult = nothing%>
View Replies
View Related
However, what I want to do is include a request.querystring("ID"), so that IF an ID is defined, eg ID=3, , it will display the relevant (not random) information. I've tried this every way I can think and get type mismatches, etc etc. It's probably really simple but I can't see it.
<%
limit=3
redim link(limit)
redim image (limit)
link(1)="xxx"
image(1)="image1.jpg"
link(2)="xxx"
image(2)="image2.jpg"
link(3)="xxx"
image(3)="image3.jpg"
randomize
random=int(rnd*limit)+1
%>
<center>
<a href="<%= link(random) %>">
<img src="<%= image(random) %>" border="0"></a>
View Replies
View Related
is there sombody who can helpme witht he following, i am ''pretty new'' to
php and am looking for a script to show images randomly at a 10/ 15 seconds
interval. is there anybody who can help me with this or does know where to
find a good template script for this?
View Replies
View Related
Is it possible to select random images from a directory without creating a "library"
As in I want to have a directory with 25 or so images and want to randomly select an image without having to change the txt document when I add new images.
View Replies
View Related
I come from a PHP background. I'm modifying a client site that uses some critical ASP code in the backend, so for simple frontend stuff I need to use it too!
I need to make sure that certain images from a random rotation only appear on certain sections of the site licensing issues. Is there any way to easily grab the name of the file that's currently loaded? I want to run some form of regex on it to check for certain words.
View Replies
View Related
I have a bit of a problem.
Basically I have a homepage, when the page loads up it will display images.
However, the images are dived into three groups, as seen below.
Group1 - Image1, Image2, Image3
Group2 - Image4, Image5, Image6
Group3 - Image7, Image8, Image9
What I want is that every time when someone enters the front page, it should pick a group and display that particular set of images on the homepage.
View Replies
View Related
I'm trying to have my program randomly select one of five images. I think my syntax is correct (that is it isn't giving my any error messages and the page loads with the image being replaced by a broken link 'X' box), but I don't know how to display the image to the screen.
Should the response.redirect part automatically display it to the screen or should I have it in some tag like <td><img scr ="lrandom"></td> within my table?
<% dim array(5)
randomize
array(1)="img1.gif"
array(2)="img2.gif"
array(3)="img3.gif"
array(4)="img4.gif"
array(5)="img5.gif"
upperbound=ubound(array)
lowerbound=0
lrandom = Int((upperbound - lowerbound + 1) * rnd + lowerbound)
response.redirect "images/" & (Array(lrandom))
%>
View Replies
View Related
I have a database of images with captions that I need to display at random on an ASP page. Once I have pulled out my recordset, what's the best way to select on item at random from the recordset to display? Also, at first I might have only 5 items in my recordset, how can I avoid the same item repeating 3 times in a row if the person clicks refresh?
View Replies
View Related
I want to provide random image on my asp page. the image will display according to products searched by user.
e.g.
if user enter pharma machine in search box, in result page the banner of pharma company will display. i.e. the banner of manufaturer/exporter of pharma machine will display.
for this i have comapny info table in database
table: comapny_info
fields in comapny_info:
company_name
products (comapny products)
description (company_description)
banner (yes/no)
dusring registration, comapny has to specify whether it wants banner or not. so if there is yes in banner and prodcuts match the search string then banner will display.
this is according to the product seaarched by user.
any idea?
View Replies
View Related
I am doing a simple program which display random records to students.The student table has the following fields(Access Database) Code:
1.Studentid-Number
2.Studentname-Text
3.Class-Text
4.Ans-Text
and Question table as
1.Questionid-Number
2.Questions-Text
Now What i am trying to do is , when the first time is student is login,he wil be shown a random record from the question and his answered wil be stored in the Ans field of the student table with column separeated.
The he will be redirected to the same page with one new question.This question should not be in the Ans Field, and must be randomly generated.I am using this code.But this not working. Code:
View Replies
View Related
I have this code that displays record sets at random, but some of time the results are less than the minimum set, which is 5 records. It is less, or none at all. What I need is for the asp to display records randomly on each submit.
Currently, the asp runs so that the whole recordset is different, i.e. Random. I am a little concerned about the load on the server by running such a script....perhaps someone can clarify.
'Set the number of records to display on each page by the constant set at the top of the script Code:
View Replies
View Related
i want to display images in my search result page according to search text enetered by user. and i want more than one images display randomly.
View Replies
View Related
On my index page I have got an area for one product to be displayed randomly from the
database. I have got it workign, but there is one problem i cant get my head around, here is the code so far:
' Initialize ASP RND() function
Randomize()
intRandomNumber = Int (1000*Rnd)+1
strsql = "SELECT TOP 1 art_Artist, art_Title, Rnd(" & -1 * (intRandomNumber) & "*cat_ID)" &_
"FROM eventDisplay " &_
"ORDER BY 3"
The code above isnt working and its when i try and draw out more that one value, as in art_Artist and art_Title.
It works fine if all I want is art_Artist, but as i said when i try to draw out more than one value the randomize function doesnt work.
View Replies
View Related
I’m having problems on how to randomiz numbers and delete the ones that have been displayed.
My first step is to take some numbers:
21, 32, 35, 4, 15 and randomize theese so the ouput may look something like this:
35, 21, 15, 32, 4
My second step is to display the first number (35), then when a user clicks on a link I want the second of my random number (21) to be displayed and I also want to delete the first number (35) that has been displayed. And this routine (display number, delete previous number) should continoue untill there is no more numbers. So again, I wnat to step through all my random numbers and delete the ones I have displayed.
Example: ....
View Replies
View Related
I have y pic's on the server and each time someone visits the site I want to display x of them randomly.
View Replies
View Related
I am trying to get random, unique pics to display but for some reason, I sometimes get the same pics showing twice.
could someone kindly shed some light on this Code: ...
View Replies
View Related
I Have searched the forum but have no solution to this problem.
I want to display my records in a random order. I loop through my records so I don't know how many records will be displayed. I dont want to count the records and then use the TOP statement. I'm looking for a better solution.
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SELECT test FROM testTable WHERE testId = 1, objConn
Do While Not rs.EOF
Response.Write "<b>" & rs("test") & "</b>" <- I want theese records to be displayed in random order
rs.MoveNext
Loop
Anyone has a solution to this problem?
View Replies
View Related
I have a database with 20 companies and their links in it. Ive tried to develop some code that i found in another forum while i was searching for a solution to 'unique random links' but, although i feel im close, Code:
View Replies
View Related
I am trying to upload large images ( around 4 mb) from the server to show on
the client. Currently I'm using an http handler to do it and breaking it
into chunks sending it 1 mb at a time. Sometimes I'm getting errors, like
the page won't load. Any solutions on how this is done right?
View Replies
View Related
I have managed up to the point that a byte[] imageContent contains a picture which i can show in a aspx page by:
// return byte array to caller with image type
Response.ContentType = "image/jpeg";
Response.BinaryWrite(imageContent);
but what i need is to post it back to the page that the user entered various details without losing them.
View Replies
View Related
i have iis5. windows 2k advance server. I have many http sites on iis. One ftp site with folders protected with userid and password. e.g i have folders at
ftp://www.mysite.com/usa
fpt://www.mysite.com/India
i mapped these folders in virtual directory as:
http:/www.mysite.com/images
and here i have folders for usa and india.
now if i try to diplay image on asp page as
http://www.mysite.com/displayimages.asp
in displayimages.asp page i give url to images file as
http://www.mysite.com/images/usa/logo.jpg
i was asked to enter userid and password. I mean to say, How can i display images on asp pages from the users, whom have posted images to their ftp folder.
View Replies
View Related
In the site we want to display the vehicle (obviously) and then a list (graphically) of the features that vehicle has, ie, air con, electric windows, abs, etc. I have attached examples of the images that should be displayed.
The images are kept in a separate folder on the website and they are 'called for' from an access database where the filed name (image id) has a check box.Currently we are only getting a TRUE response and the image is not being displayed. We are looking for some help in how to develop this and get only the image displayed if the check box is ticked on the database.
View Replies
View Related
anyone know of an application that integrates with Dreamweaver to allow me to work with blob images from a SQL database and put them in an ASP.NET page?
View Replies
View Related
I have an ASP 3.0 website on which the images are displaying intermittently.
In other words, when I request a page, the image is blank. There is no missing image place marker (rectangle with a red X).
The location where the image should be is just empty.
The code is there to display the image as can be seen when you view source in the browser
And if you later return to the page, or sometimes if you simply refresh it, the image will render properly.
What could be causing this erratic behavior?
I'm not sure whether this is an ASP issue, an HTML issue, a browser issue (the error occures in IE 6.0) or possibly a network issue.
View Replies
View Related
How can I display images that reside in my database through an ASP page?
View Replies
View Related
I am creating a form with checkboxes that contains in the value property, the ID of the image. The filename of the image displayed above the checkbox along with the image.
On that page, I am storing the "checked" information in a cookie. When the user clicks submit, I need to retrieve the actual image that they selected on the previous page and display it along with the image name which I get from the value property.
Right now the only data being passed is the value in the checkbox input tage which is a text string and not the actual image. How do I retrieve the images my users checks off. I hope this make sense. Sort of like a shopping cart, but I only want to be able to select images and post back the ones selected.
View Replies
View Related
I have the standard folder structure on my web server (sya that the server is estserver):
My site is in c:Inetpubwwwrootmysite
I have also introduced the folders:
c:Inetpubimagerootcompany1
c:Inetpubimagerootcompany2
c:Inetpubimagerootcompany3
The idea is security (the companyN folders store images belonging to the companies 1,2,3 - and never the twain shall meet - this does not matter so much). The images are stored above MySite (in the imageroot folder) so that no-one can see them - if they sat in mysiteimages, for example, anyone can see them. And to further thre security, /imageroot does not have a URL
What I need is someway that I can display an image in imageroot on a page in MySite, eg /mysite/gallery.
I need to use an absolute path from my page in mysite to the required image
so in HTML that would be
<IMG SRC=" estserverinetpubimagerootcompany1picture.gi f">
however, that don't work. So how do you do it?
View Replies
View Related
just manged to get an image retireval search engine working. The ASP script works fine, my query results are filepaths of images.
i structured a query in within asp to obtain images which have similar textual values. It is more of a cosmetic issue. when i get my query results back, my script prints or displays the images from top to bottom. which means i have to scroll vertically up and down the asp page over 10-30 images. Code:
View Replies
View Related
I am trying to build a simple image gallery,that displays image form the files on web server and displays it on webpage.
I tried,but it gives an error:
Quote: Error Type:
Active Server Pages, ASP 0113 (0x80004005)
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
Here is the code:
View Replies
View Related
I just wanted to know whats the best way to generate 50 or say X amount of number at random without having to repeat any of the previous number...
so far I've the following:
[VBS]<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
function RandomNumber()
dim theRandom
Randomize
'RandomNumber = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
theRandom= Int((99 - (0) + 1) * Rnd + (0))
if (theRandom<10) then theRandom = "0" & theRandom
RandomNumber = theRandom
end function
%>[/VBS]
and then I've this in the body of HTML doc: Code:
View Replies
View Related
We have the need to have a random token (a 16 char alphanumeric field) to be used as the key for one of our SQL tables. I have created a random token generator, however after only 3 months in production, it appears that we had an instance where a token that already existed in the tables was created. There are 3810 records currently in the database so it isn't like there are billions of records there.
I contacted an old college buddy of mine who is a mathematician, and he claims, assuming that random really does mean random, that the chances of getting a duplicate token are 1 in 79.5 septillion (79,500,000,000,000,000,000,000,000).
So my conclusion is that this was either a complete freak of nature occurance, or my random generator isn't really all that random. Here is the code behind how I am generating this: Code:
View Replies
View Related
I am trying to generate a random number. I am using randomize and then rnd to return a decimal number between 100 and 120. This will give me a longitude. I am doing something similar to generate a latitude.
I created this on a page which refreshs every minute. I put these points into a map and they are showing up in groups of straight lines. Since rnd is time based will refreshing every 60 seconds return similar numbers?
View Replies
View Related