-
Hey guys, your fellow VB and ASP programmer Xenonic Rob here. Just a question - is it possible to send an image as a response from an ASP script, without any components? I mean, so you could call it from an HTML page like this:
<IMG Src="http://www.server.com/script.asp?varible=value">
Is it possible?
-
Sure, but you have to do it like this:
<IMG Src="http://www.server.com/script.asp?varible=<%=value%>">
Assuming that value contains a valid picture file.
-
You don't understand.
I mean I need to generate say a JPG file on the fly, so it can be called from a normal HTML docuemnt. I don't mean another ASP script.
-
Not without software to do Jpg compression. Where does the image come from? Thin air? What would you create an image of? You would HAVE to have some sort of component on the server generating the image in the first place. (Unless you can response.write the exact binary sequences needed to produce an image- not likely)
-
monte96 - hey - chill out!
There's no need to get so stressy with me! I was just enquiring whether it would be possible to load a JPG off the server or something, and then Response.Write that in....
Man - you need to take a chill pill!!
-
Sorry..didn't think I was 'stressy' but whatever..
I guess I don't understand what you're trying to do either cuz:
<IMG src="image.jpg">
would load an image off the server. Other than add some server load, I'm not sure what you would accomplish. Unless your trying to load a different pic depending on different situations then you can just response.write the different filename into the src attribute.
-
Hi there,
How about creating the jpg file on the server from within the asp script and then making a reference to it from the client?
If it is possible to create a jpg file like that using VBScript, could you pls post the code? I will be very grateful.
-
This is where I point out my previous argument: You can't create a jpg with just VBScript. You have to have some kind of external component on the server. You could have a component that renders text as images using predetermined fonts, BUT you would have to have created the component in something other than VBScript and it would have to have the ability to do jpg compression of images when it outputs the image to the server. The component could return the name of the file to the calling function in script and then an image tag could be constructed. (sorry if this sounds stressy..)
-
OK - try this out:
I'm doing a hit counter service, and I want users to be able to show their hitcounter like <Img src="www.myserver.com/script.asp?account=theiraccount"> Because of this, I want to be able to string together a combination of 4 digits, so thats 4 GIF images. Is this possible in pure VBScript?
-
Yes, you'd have to pull up their hits from a database using a SQL string, and then use Select Case statements and string manipulation to go through each digit of the number of hits, and create a string of images. This will load an image for each digit. If you wanted a single image for the entire number, you'd need that server-side JPG compression thingy that the other guy was talking about.
-
pactalon,
He wants the asp script to return an image. I don't think it is possible do you?
-
It doesn't work. I have tried it with Scripting.FileSystemObject. Here is what I have done.
<%
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextStream("c:\my file.jpg")
a = f.ReadAll
Response.Write a
%>
The result does not show a picture in the browser window.
-
You would need a third-party image compression component. Ask the guy who runs http://www.cooltext.com for advice.
-
Thanks guys for all your help.