473,688 Members | 3,202 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 2237
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
6544
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
2825
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
4336
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
3356
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
5372
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
1759
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
1114
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
1802
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
2829
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
8590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9072
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
8947
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
8782
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,...
1
6453
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
5807
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4321
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2215
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.