Results 1 to 14 of 14

Thread: Question to do with the IMG tag and ASP Scripts..... please help!

  1. #1

    Thread Starter
    Addicted Member Xenonic_Rob's Avatar
    Join Date
    Jun 2000
    Location
    England, UK
    Posts
    213

    Exclamation

    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?

    Rob Wright
    E-mail: [email protected]
    Website: http://www.xenonic.com
    The First Member of Honeybee's Club
    Favourite words: Zugzwang and Empiric

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    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.

  3. #3

    Thread Starter
    Addicted Member Xenonic_Rob's Avatar
    Join Date
    Jun 2000
    Location
    England, UK
    Posts
    213
    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.

    Rob Wright
    E-mail: [email protected]
    Website: http://www.xenonic.com
    The First Member of Honeybee's Club
    Favourite words: Zugzwang and Empiric

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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)

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  5. #5

    Thread Starter
    Addicted Member Xenonic_Rob's Avatar
    Join Date
    Jun 2000
    Location
    England, UK
    Posts
    213
    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!!

    Rob Wright
    E-mail: [email protected]
    Website: http://www.xenonic.com
    The First Member of Honeybee's Club
    Favourite words: Zugzwang and Empiric

  6. #6
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  7. #7
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    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.

  8. #8
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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..)

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  9. #9

    Thread Starter
    Addicted Member Xenonic_Rob's Avatar
    Join Date
    Jun 2000
    Location
    England, UK
    Posts
    213
    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?

    Rob Wright
    E-mail: [email protected]
    Website: http://www.xenonic.com
    The First Member of Honeybee's Club
    Favourite words: Zugzwang and Empiric

  10. #10
    Banned
    Join Date
    Feb 2000
    Location
    Edmonton, AB, Canada
    Posts
    64
    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.

  11. #11
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    pactalon,

    He wants the asp script to return an image. I don't think it is possible do you?

  12. #12
    Addicted Member
    Join Date
    Sep 2000
    Posts
    219
    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.

  13. #13
    Banned
    Join Date
    Feb 2000
    Location
    Edmonton, AB, Canada
    Posts
    64
    You would need a third-party image compression component. Ask the guy who runs http://www.cooltext.com for advice.

  14. #14

    Thread Starter
    Addicted Member Xenonic_Rob's Avatar
    Join Date
    Jun 2000
    Location
    England, UK
    Posts
    213
    Thanks guys for all your help.

    Rob Wright
    E-mail: [email protected]
    Website: http://www.xenonic.com
    The First Member of Honeybee's Club
    Favourite words: Zugzwang and Empiric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width