Solved

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

Posted on 2003-11-21
14
1,846 Views
Last Modified: 2013-11-19
Hi,

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)==========
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
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".

P.S

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,

James.
0
Comment
Question by:James_Andrews
  • 4
  • 3
  • 2
  • +2
14 Comments
 
LVL 5

Accepted Solution

by:
rajaamirapu earned 125 total points
Comment Utility
0
 
LVL 16

Assisted Solution

by:Richie_Simonetti
Richie_Simonetti earned 125 total points
Comment Utility
0
 
LVL 9

Assisted Solution

by:Dang123
Dang123 earned 125 total points
Comment Utility
0
 

Author Comment

by:James_Andrews
Comment Utility
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.
0
 
LVL 28

Assisted Solution

by:AzraSound
AzraSound earned 125 total points
Comment Utility
Shouldn't your ASP code say:

objResize.ResizeImage ??


Have you tried debugging the dll at all?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 16

Expert Comment

by:Richie_Simonetti
Comment Utility
:))
, azra is right!
0
 

Author Comment

by:James_Andrews
Comment Utility
Yes, sorry, that is a typo.

Azra,

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).
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
How far into the code of the DLL do you get when debugging before the error occurs?
0
 

Author Comment

by:James_Andrews
Comment Utility
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".
0
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
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.
0
 

Author Comment

by:James_Andrews
Comment Utility
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.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this Micro Tutorial viewers will learn how to remove an unwanted object using Photoshop’s feature known as content-aware fill.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now