Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


ActiveX DLL to scale-resize an image (jpg or gif) from ASP.

Posted on 2003-11-21
Medium Priority
Last Modified: 2013-11-19

I am trying to build an ActiveX Dll for use from ASP, to resize a specified image to the required size.  The image resize must be to scale and the program must support JPG, GIF and BMP.

I have some code (in VB6) which I have started with (not sure if this will only work for bitmaps - if at all).

=============Code in VB6 (the dll file) ====================
Public Sub ResizeImage(sImgPath, sNewPath, iWidth, iHeight)

Form1.Image1.Picture = LoadPicture(sImgPath)
Set Picture1.Picture = Image1.Picture

Form1.Picture1.AutoRedraw = 1

Form1.Picture1.PaintPicture Form1.Image1.Picture, 1, 1, iWidth, iHeight
SavePicture Form1.Picture1.Picture, sNewPath

End Sub

I then call this from the ASP page:

========ASP Code (in the resizeimage.asp file)==========
Dim objResize

Set objResize = Server.CreateObject("MyResize.ImageResizer")
MyResize.ResizeImage "C:\Site\htDocs\Futurama.bmp","C:\Site\htDocs\Futurama_sm.bmp",80,60
Set MyResize=Nothing

NB: This is example code and intentionally uses literals.

The ASP page returns "Object Required" on line 6 (MyResize.ResizeImage) - but does seem to execute past the Form1.Image1.Picture = LoadPicture(sImgPath) line because if you pass an invalid filename to MyResize.ResizeImage then the ASP error returns "File not found".


The DLL file is correctly registered and I cannot see any permissions problems (either to the DLL file or the Image Files).

Please advise if this method is innappropriate for my requirements.

Thank you for your time,

Question by:James_Andrews
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2

Accepted Solution

rajaamirapu earned 500 total points
ID: 9796424
LVL 16

Assisted Solution

Richie_Simonetti earned 500 total points
ID: 9796660

Assisted Solution

Dang123 earned 500 total points
ID: 9796726
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 9796953
Thanks for your responses.

The resizing of the image is not for display.  I want to take load an image file, "Dog_Big.jpg", and create a scaled down version of it "Dog_Small.jpg".

Sorry if this wasn't clear.
LVL 28

Assisted Solution

AzraSound earned 500 total points
ID: 9799333
Shouldn't your ASP code say:

objResize.ResizeImage ??

Have you tried debugging the dll at all?
LVL 16

Expert Comment

ID: 9799459
, azra is right!

Author Comment

ID: 9799710
Yes, sorry, that is a typo.


I am trying to debug the DLL, but the only error I get is the error from the ASP page, which is object required (the other code does not have that typo).
LVL 28

Expert Comment

ID: 9799769
How far into the code of the DLL do you get when debugging before the error occurs?

Author Comment

ID: 9799792
From above:

The ASP page returns "Object Required" on line 6 (MyResize.ResizeImage) - but does seem to execute past the Form1.Image1.Picture = LoadPicture(sImgPath) line because if you pass an invalid filename to MyResize.ResizeImage then the ASP error returns "File not found".
LVL 28

Expert Comment

ID: 9799826
Is the picture saved to the file?  I assume Set MyResize = Nothing is a typo as well?

What I meant be debugging was, go to Project -> Properties in your DLL project, select the Debugging tab, ensure "wait for components to be created" option is selected.  Press F5 to put your project in "run" mode with a breakpoint set on the first line in your ResizeImage sub routine.  Then open your ASP page that calls this dll and it should jump into your DLL project allowing you to step through the code.

Author Comment

ID: 9799865
Yes, thats's a typo as well.  I renamed it MyResize in the code to make it obvious that it was my component - must have missed those two.

OK - Thanks very much - I didn't know you could do that.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Learn the basics of inputting and editing your text components in Prezi. We will cover how to set styles, position, and group your text components. In your Prezi editor, click anywhere on the canvas to add text: A flashing cursor informs you that yo…
It’s easy to embed any of your public Prezi presentations on your website or social network to share with others. Learn how simple it is in this tutorial.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question