?
Solved

random images from remote host?

Posted on 2001-07-19
8
Medium Priority
?
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 20

Expert Comment

by:Silvers5
ID: 6301090
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
ID: 6301122
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
ID: 6301956
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:weesiong
ID: 6304263
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
 

Author Comment

by:ghettocooler
ID: 6306228
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 800 total points
ID: 6307064
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
ID: 8623269
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
ID: 8674361
As recommended

Chmod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

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