Results 1 to 4 of 4

Thread: Image Processing

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    I need to do some dynamic thumbnailing from ASP, and I've decided to write a VB Component to do this.

    This is what I know:
    I'll write an ActiveX dll, which will contain a function. From asp I will call this function with one argument, namely the path to the image I want to thumbnail. In VB this function will accept this string as a Variant. Once I associate this String to an image object, then I can do what I need to do (i.e calculate aspect ratio, set stretch to true, resize it and save it). I'll return a boolean representing success/fail.

    What I don't know:
    1)I don't know how to go from the step of having the filename as a String and actually getting an Image to work with.


    Thanks!
    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  2. #2
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72

    Arrow

    Look up the LoadPicture function. You can use it something like this:

    Picture1.picture = LoadPicture(filenamestring)

    There are some other args you can pass it, such as colordepth, height and width.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    thanks!
    jsut what i needed. will look that up.

    /d8
    Secret to long life:
    Keep breathing as long as possible.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    Question trying to get this component stuff figured out

    Here is the code I have;

    Code:
    Option Explicit
    
    Public Function goImage(myFileName As Variant) As Boolean
        On Error Resume Next
        Dim Picture1 As Object
    
        myFileName = CStr(myFileName)
        Picture1.Picture = LoadPicture(myFileName)
    
        If Err.Number <> 0 Then
            goImage = False
        Else
            goImage = True
        End If
    
    End Function
    I've put this in a class called ImageFun, in a project named Fun.dll. After compiling this .dll and registering it on the server, I tried calling it from ASP with the following:
    Code:
    set foo=Server.CreateObject("Fun.ImageFun")
    Which gives me the error: "Invalid class string"

    Does that make sense?

    Another question: Since it's an activeX dll, there is no form. I'm assuming that normally Picture1 would be the name of a Picture control that you would embed on a form. In my code I simply declare Picture1 as an object. Is this sufficient? Or do I have to declare it as something else?

    Thanks
    dvst8

    [Edited by dvst8 on 06-26-2000 at 08:56 PM]
    Secret to long life:
    Keep breathing as long as possible.

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