Solved

random images from remote host?

Posted on 2001-07-19
8
232 Views
Last Modified: 2008-03-17
I have a site that pulls random images from my own server, this is no problem...

I would like to provide people with the ability to add their own random photos... However I do not want to host these images... I want, what seemed simple enough, for them to provide me with a url where they can be found.

I have forms in place that when filled out place a cookie on the users machine, containing the URL to the folder full of images...

I also have no problem reading that url...  I have it stored in a variable called "mypath"  the problems occur when using the next lines of code:

Set folder = filesystem.GetFolder(server.mappath(mypath))
Set filesystem = CreateObject("Scripting.FileSystemObject")
Set filecollection = folder.Files


I fully understand that when using mappath, it maps whatever server the asp file resides on... along with the FileSystemObject and the ability to see those files.

I can find no alternative to actually mapping the server...  I want the ability to name my image files whatever I'd like (as opposed to just numbers) and eventually the ability to allow shockwave files to be pulled at random also.

Essentially, I want to pull random images from remote hosts...

i hope this makes sense...
0
Comment
Question by:ghettocooler
8 Comments
 
LVL 20

Expert Comment

by:Silvers5
Comment Utility
first:
Set filesystem = CreateObject("Scripting.FileSystemObject")
Set folder = filesystem.GetFolder(server.mappath(mypath))
Set filecollection = folder.Files

second: the above is useless.. you can't map a file on a remote server from the url provided.. you can't view the file using fso ... your best solution is to fetch the image using a component or the XMLObjects:

How do I read the contents of a remote web page?    
You can include static txt and HTML files from remote servers by using a component (such as AspHTTP (http://www.serverobjects.com/products.htm), ASPTear (http://www.alphasierrapapa.com/ComponentCenter/AspTear/), or VB's built in InetCtrls) to parse the remote URL's content.
 
You can also try this method out, it uses the MSXML objects which are installed with Windows 2000 (or you can download them here (http://download.microsoft.com/download/xml/Install/3.0/WIN98Me/EN-US/msxml3.exe) for other operating systems):
 
<%
    url = "http://www.espn.com/"
    set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send ""
    Response.write xmlhttp.responseText
%>

0
 
LVL 7

Expert Comment

by:weesiong
Comment Utility
ghettocooler,

In the first case, you need to know the images name in your remote server. and later it:

<%
Randomize
MYImage = Int((6 * Rnd) + 1) 'you have 6 images in remote server
MYImage = MYImage & ".gif"
%>

img src="http://www.remoteserver.com/<%=MYImage%>">

Regards,
Wee Siong
0
 

Author Comment

by:ghettocooler
Comment Utility
How can I not limit, or specify the number of images?...  Whatever's in the folder on the remoteserver; pull at random... (gifs or Jpgs)
0
 
LVL 7

Expert Comment

by:weesiong
Comment Utility
ghettocooler,

no sure you can do it, because at less you want to know the name for the remoteserver, and you just can do it :)

So tell me more about your remoteserver info, i will give the suggestion :)

Regards,
Wee Siong
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:ghettocooler
Comment Utility
If I could only translate this from english to asp...


<%
randomSRC = Any file in the folder named Random at this url(http://www.theURLISelected.com) ending in .gif, or .jpeg
%>

<img src="<%= randomSRC %>">

When working with randomizing files; Does asp require you to creata a fileCollection?; So it can kind of scan through every file?



0
 
LVL 7

Accepted Solution

by:
weesiong earned 200 total points
Comment Utility
ghettocooler,

No, this is easy as like you say:
<img src="<%= randomSRC %>">

but the problem now you "canot know" how many files in the server, and it means you "canot know" the files name for server :(

Regards,
Wee Siong
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[points to weesiong]

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

hongjun
EE Cleanup Volunteer
0
 

Expert Comment

by:Chmod
Comment Utility
As recommended

Chmod
Community Support Moderator @Experts Exchange
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now