|
-
May 6th, 2008, 12:43 PM
#1
Thread Starter
New Member
Creating a dynamic Photo Gallery
I'm trying to create a dynamic photo gallery. I want users to be able to upload pictures to a directory then edit a text file in the text file they will specify the file location and a description for the graphic. I then need to create client side script that will retrieve that text file open it and sort all of the CSV entries to create a photo gallery for instance
Person will upload files to "www.mypage.com/pictures"
the file is called "picture1"
the title is "Florida 2007"
and the caption is "me at the beach"
and lets say there are 50 or so of these pictures, how do I read the information from the text file and place all of the informaiton into arrays
pictures(50)
title(50)
caption(50)
I'm hosting the site off of an apache server which doesn't support ASP. And I'm too lazy to learn PHP. Is there a way to do this using a client side script?
-Chris
-
May 6th, 2008, 01:01 PM
#2
Re: Creating a dynamic Photo Gallery
Moved to PHP where someone may encourage you or show you a simple way of doing this in PHP (since you said your host doesn't support ASP).
-
May 6th, 2008, 01:40 PM
#3
Thread Starter
New Member
Re: Creating a dynamic Photo Gallery
I would prefer to do this is a client side vbscript
-
May 6th, 2008, 01:47 PM
#4
Re: Creating a dynamic Photo Gallery
Are you aware that the VBScript solution will only work in Internet Explorer and not Firefox?
Because you're hosting on an Apache server, your VBScript will not have access to the file system on the Apache server itself. And while indeed you could have the VBScript read the text file for information and get the images as well via an HTTP request, you're not going to be able to perform the uploads without some server side scripting. You will also not be able to allow the users to edit the text file on the server, since this is all client side. Not to mention that this, even if it worked, would be an extremely slow solution.
You will need to look at a server side scripting solution to accomplish what you have mentioned in Post #1.
-
May 6th, 2008, 01:51 PM
#5
Thread Starter
New Member
Re: Creating a dynamic Photo Gallery
uploads will be handled in a different manner. I really only need to know how to read the data from a text file and sort them into arrays.
-
May 6th, 2008, 02:40 PM
#6
Re: Creating a dynamic Photo Gallery
-
May 15th, 2008, 04:17 PM
#7
Thread Starter
New Member
Re: Creating a dynamic Photo Gallery
Alright let me make it simple. I need a client side script written in VB script that will be able to access a .CSV file and separate each line into 3 arrays for example
Mycsvfile.csv
=============
IMG00001.jpg, "Me at the beach", "That's me at the jersey shore"
IMG00002.jpg, "My dog", "My dog playing with her favorite ball"
IMG00003.jpg, "My cat", "My cat falling off of the radiator"
=============
How would I get VB Script to read those values into 3 separate arrays?
-
May 16th, 2008, 02:31 AM
#8
Hyperactive Member
Re: Creating a dynamic Photo Gallery
hi there
if u can solve this case u will get what u want
http://www.vbforums.com/showthread.p...53#post3229653
thanks
In the name of allah , the beneficent , the merciful
Say (O Muhammad ): We believe in allah and that which is revealed unto us and that which was revealed unto abraham and ishmael and isaac and jacob and the tribes , and that which was vouchsafed unto moses and jesus and the prophets from their lord . we make no distinction between any of them , and unto him we have surrendered
---- Great Sites For You -------------------
If you want to know some small things about islam ?
-
May 17th, 2008, 08:57 AM
#9
Thread Starter
New Member
Re: Creating a dynamic Photo Gallery
I'm starting to get a little annoyed here. Please read carefully. I need the VB code to read from a server side text file and then split it into 3 arrays it has to be done this way please don't send me entire scripts for a photo gallery I have that all completed I just need to know how to read from a server side text file that's it. I appreciate your enthusiasim but it makes more work for me.
-
May 17th, 2008, 10:43 AM
#10
Re: Creating a dynamic Photo Gallery
See if this gets you started
Code:
Option Explicit
Const ForReading = 1
Dim fso
Dim strFilePath
Dim ts
Dim arrPictures
Dim arrTitle
Dim arrCaption
Dim arrLines()
Dim i
Dim UB
strFilePath = "c:\Mycsvfile.csv"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(strFilePath, ForReading)
'Read each line into an array
Do While Not ts.AtEndOfStream
Redim Preserve arrLines(i)
arrLines(i) = ts.ReadLine
i = i + 1
Loop
'Cleanup
ts.Close
Set ts = Nothing
Set fso = Nothing
'Set the array sizes for the details
UB = i - 1
Redim arrPictures(UB)
Redim arrTitle(UB)
Redim arrCaption(UB)
'Loop through the lines and add your details to the arrays
For i = 0 to UB
arrPictures(i) = Split(arrLines(i),",")(0)
arrTitle(i) = Split(arrLines(i),",")(1)
arrCaption(i) = Split(arrLines(i),",")(2)
Next
'Now just to see if it works
Dim strMess
For i = 0 to UB
strMess = "Line #" & i + 1 & vbcrlf
strMess = strMess & "Picture = " & arrPictures(i) & vbcrlf
strMess = strMess & "Title = " & arrTitle(i) & vbcrlf
strMess = strMess & "Caption = " & arrCaption(i)
MsgBox strMess
Next
-
May 17th, 2008, 01:19 PM
#11
Re: Creating a dynamic Photo Gallery
 Originally Posted by [email protected]
I'm starting to get a little annoyed here. Please read carefully. I need the VB code to read from a server side text file and then split it into 3 arrays it has to be done this way please don't send me entire scripts for a photo gallery I have that all completed I just need to know how to read from a server side text file that's it. I appreciate your enthusiasim but it makes more work for me.
Please read carefully: You cannot access a CSV file on a web server from client side VBScript unless the CSV file is available under an http location.
If you have an http location available to you, then you will need to do a little more in addition to MarkT's code above. You will first need to get the contents of the CSV file via an HTTP Request. Please confirm that you do have the CSV file available in an http path (a URL).
You can then get the CSV file like this
Code:
'http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-file/
' Set your settings
strFileURL = "http://www.domain.com/file.zip"
strHDLocation = "D:\file.zip"
' Fetch the file
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
objXMLHTTP.open "GET", strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
Set objADOStream = CreateObject("ADODB.Stream")
objADOStream.Open
objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = Createobject("Scripting.FileSystemObject")
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
Set objADOStream = Nothing
End if
Set objXMLHTTP = Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|