473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASPJPEG Help

I am having some trouble here, and my brain is running on empty. I am
not an expert ASP coder, so forgive me for what is probably sloppy
code, and not the best...

At any rate, I have created the following code to randomly select an
image under a random set of folders from my gallery. Once that is done,
I call sendbinary.asp which should size and display the image... Here
is my code. Problem is, I am getting a good ole red X. It looks like it
is passing things okay, but still not working.

The URL for test is http://earth.sitepros.net/test/rndimage.asp

rndimage.asp

------------------------
<%

Const ImagesRoot = "images"
Const ThumbsFolder = "__thumbs"

' Get List of Subfolders under ImagesRoot
Set fsoFolder = CreateObject("Scripting.FileSystemObject")

Set FolderRoot =
fsoFolder.GetFolder(Server.MapPath(ImagesRoot))

Set FolderSubs = FolderRoot.subfolders

' Get a Random Folder Number from List
randomize
RndFolderNum = Int(FolderSubs.count * Rnd)

' Associate Folder name based on Random Number Results
For Each objFolder in FolderSubs
If intFileLooper = RndFolderNum Then
' Get a "handle" on the appropriate file
Set objFolderToUse = objFolder
Exit For
End If
intFileLooper = intFileLooper + 1
Next

'Clean up Above Variables
Set fsoFolder = Nothing
Set FolderRoot = Nothing
Set FolderSubs = Nothing
Set RndFolderNum = Nothing
' Build Complete Virtual Path to Random Folder
objFolderToUsePath = (ImagesRoot & "/" & objFolderToUse.name & "/" &
ThumbsFolder &"/")

' Get a List of Image Files from Folders
Set fsoFile = Server.CreateObject("Scripting.FileSystemObject")
Set objFolderObject =
fsoFile.GetFolder(Server.MapPath(objFolderToUsePat h))

Set objFileCollection = objFolderObject.Files

' Get a Random File Number from List
randomize
intFileNumberToUse = Int(objFileCollection.Count * Rnd) + 1

' Associate File name based on Random Number Results
intFileLooper = 1
For Each objFile in objFileCollection
If intFileLooper = intFileNumberToUse Then
' Get a "handle" on the appropriate file
Set objImageFileToUse = objFile
Exit For
End If
intFileLooper = intFileLooper + 1
Next

' Clean up Above Variables
Set fsoFile = Nothing
Set objFolderObject = Nothing
Set objFileCollection = Nothing

' Build our img src tag text
strImageSrcText = objFolderToUsePath & objImageFileToUse.Name

%>
<!- Display The Image ->
<img src ="sendbinary.asp?path=<%= strImageSrcText %>&width=125">
<%

'Clean up Remaining Variables
Set objFolderToUse = Nothing
Set objFolderToUsePath = Nothing
Set objImageFileToUse = Nothing
Set strImageSrcText = Nothing

%>

sendbinary.asp
------------------------
<%
Response.Expires = 0
' create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")

' Open source file
Jpeg.Open( Request("path") )

' Set new height and width
Jpeg.Width = Request("Width")
Jpeg.Height = Jpeg.OriginalHeight * Jpeg.Width / Jpeg.OriginalWidth

' Perform resizing and
' send resultant image to client browser
Jpeg.SendBinary

%>

Oct 6 '05 #1
1 2222
Well I figured out what my problem was. I was using a virtual path, not
a complete physical path. So the code works now! I have an image
rotator on my site that pulls random images from random dirs.

Here is a link to my site, as well the code for the image rotator.

http://weblog.sitepros.net/journal_c...p?JournalID=79

Oct 7 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
0
by: Christopher Brandsdal | last post by:
Hello! I am making a upload script for my images. I want the script to resize the images automaticly. The server supports AspJpeg but i don't have AspUpload. Can anyone help me to implement the...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
3
by: Tony | last post by:
Hello, I'm using already a long time aspjpeg in asp to add my logo and some text over my images on my website. Since a couple of months I changed over to asp.net in vbscript. But I don't find...
0
by: Tony | last post by:
Hello I have a working code for asp that I want to use now in asp.net. The code is included below. With this code I create a red bar on the bottom of an image, in which I give some comment on...
2
by: Tony | last post by:
Hello I have a working code for asp that I want to use now in asp.net. The code is included below. With this code I create a red bar on the bottom of an image, in which I give some comment on...
0
by: dann2 | last post by:
hello, i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this: ... '<% ' Create an instance of AspUpload object 'Set...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.