Converting BMP to JPG

J

jodleren

Hi all

I found an example how to convert an BMP file to JPG, but it does not
work - I cannot find much about it

The current code is

Dim oPicture as StdPicture
Set oPicture = LoadPicture(f11.name)
SavePicture oPicture, sFolder & "\temp\" & mid(f11.name, 1, Len
(f11.name)-1) & ".jpg"
Set oPicture = Nothing

but I probably need an obejct?
what do I do wrong?
 
B

Bob Barrows

jodleren said:
Hi all

I found an example how to convert an BMP file to JPG, but it does not
work - I cannot find much about it

The current code is

Dim oPicture as StdPicture
^^^^^^^^^^^^^^^
Well, this is certainly not vbscript so I suspect you are using asp.net,
in which case:

There was no way for you to know it (except maybe by browsing through
some of the previous questions before posting yours - always a
recommended practice), but this is a classic (COM-based) asp newsgroup.
ASP.Net is a different technology from classic ASP. While you may be
lucky enough to find a dotnet-savvy person here who can answer your
question, you can eliminate the luck factor by posting your question to
a newsgroup where the dotnet-savvy people hang out. I suggest

microsoft.public.dotnet.framework.aspnet.

There are also forums at www.asp.net where you can find a lot of people
to help you.
 
J

jodleren

                             ^^^^^^^^^^^^^^^
Well, this is certainly not vbscript so I suspect you are using asp.net,
in which case:

I got the example from this NG - I am usung asp (without .net), so I
need another solution.... any ideas?
 
B

Bob Barrows

jodleren said:
I got the example from this NG - I am usung asp (without .net), so I
need another solution.... any ideas?

That solution will not run in ASP. vbscript does not support typed
variables. In order to run this in ASP you would at least have to do
this:

Dim oPicture

Set oPicture = LoadPicture(f11.name)
Neither LoadPicture nor SavePicture are vbscript methods so you will at
least need to instantiate an object that has those methods. Did the
solution you got from this newsgroup provide that information? If not,
you need to go back to google. I've never had to do this type of task so
I can't help you without resorting to google myself. Actually, you might
start at the www.aspfaq.com site to see if Aaron included information
about binary file conversion.
 
D

Dan

jodleren said:
Hi all

I found an example how to convert an BMP file to JPG, but it does not
work - I cannot find much about it

The current code is

Dim oPicture as StdPicture
Set oPicture = LoadPicture(f11.name)
SavePicture oPicture, sFolder & "\temp\" & mid(f11.name, 1, Len
(f11.name)-1) & ".jpg"
Set oPicture = Nothing

but I probably need an obejct?
what do I do wrong?


This is Visual Basic 6 code, and will not run in VBScript ASP. You could
create an ActiveX DLL (COM DLL) in VB6 using similar code in a method and
compile it to a DLL, install that on your web server (assuming you are
allowed to install DLLs on the server), and then call the DLL with the
appropriate parameters for your method. But I would suspect it might be
easier for you to install an existing commercial (or free) image conversion
component, or if your site is not your own check with the hosting company to
see if they already have something installed which will allow you to this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top