473,911 Members | 6,170 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("S cripting.FileSy stemObject")

Set FolderRoot =
fsoFolder.GetFo lder(Server.Map Path(ImagesRoot ))

Set FolderSubs = FolderRoot.subf olders

' 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
objFolderToUseP ath = (ImagesRoot & "/" & objFolderToUse. name & "/" &
ThumbsFolder &"/")

' Get a List of Image Files from Folders
Set fsoFile = Server.CreateOb ject("Scripting .FileSystemObje ct")
Set objFolderObject =
fsoFile.GetFold er(Server.MapPa th(objFolderToU sePath))

Set objFileCollecti on = objFolderObject .Files

' Get a Random File Number from List
randomize
intFileNumberTo Use = Int(objFileColl ection.Count * Rnd) + 1

' Associate File name based on Random Number Results
intFileLooper = 1
For Each objFile in objFileCollecti on
If intFileLooper = intFileNumberTo Use Then
' Get a "handle" on the appropriate file
Set objImageFileToU se = objFile
Exit For
End If
intFileLooper = intFileLooper + 1
Next

' Clean up Above Variables
Set fsoFile = Nothing
Set objFolderObject = Nothing
Set objFileCollecti on = Nothing

' Build our img src tag text
strImageSrcText = objFolderToUseP ath & objImageFileToU se.Name

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

'Clean up Remaining Variables
Set objFolderToUse = Nothing
Set objFolderToUseP ath = Nothing
Set objImageFileToU se = Nothing
Set strImageSrcText = Nothing

%>

sendbinary.asp
------------------------
<%
Response.Expire s = 0
' create instance of AspJpeg
Set Jpeg = Server.CreateOb ject("Persits.J peg")

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

' Set new height and width
Jpeg.Width = Request("Width" )
Jpeg.Height = Jpeg.OriginalHe ight * Jpeg.Width / Jpeg.OriginalWi dth

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

%>

Oct 6 '05 #1
1 2246
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
6586
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 Workshop program: hcw.exe that's included with Visual Basic. This exact same file compiled perfectly with no notes, warnings or errors prior to reformatting my system. Prior to the reformatting, I copied the help.rtf file onto a CD and checked the box to...
0
2858
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 AspJpeg code into my upload code? AspJpeg CODE. '---------------------------------------------------------------------------
6
4379
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 result in any way. Who can help me, I thank you very very much. list.cpp(main program) //-------------------------------------------------------------------------- - #pragma hdrstop #pragma argsused
3
3379
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 numarray, help gives unhelpful responses:
7
5416
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 from clicking on many of the available topics (mostly methods but some properties are also unavailable). This same problem occurs with many, if not most, keywords. Is there any way I can activate these "missing" help topics? HELP!
3
1767
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 the way to write the code to be able to use aspjpeg with vbscript in asp.net Who can give me some complete code examples to do this?
0
1131
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 the image and the URL of the website. In the code image.asp I define the file name of the image (img), the comment (txt) and the url (url). In the later stage in the project, this info will be created dynamically depending on the requested image....
2
1816
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 the image and the URL of the website. In the code image.asp I define the file name of the image (img), the comment (txt) and the url (url). In the later stage in the project, this info will be created dynamically depending on the requested image....
0
2843
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 Upload = Server.CreateObject("Persits.Upload") ' Capture uploaded file. Save returns the number of files uploaded 'Count = Upload.Save(Path) 'If Count = 0 Then 'Response.Write "message"
0
9879
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11055
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.