Need help getting gflax to work

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, xnview

ruthless
Posts: 11
Joined: Wed Jan 05, 2005 7:06 pm

Need help getting gflax to work

Post by ruthless »

Hi guys...

I am having a tough time getting the dll file to work in ASP.

I am using windows 98 with Personal Web Server 4.

I did not install xnview on my local server. Instead I copied the GflAx directory to my home server (an old machine).

I registered c:\GflSDK\GflAx\Lib\std\GflAx.dll with windows by typing

regsvr32 c:\GflSDK\GflAx\Lib\std\GflAx.dll

which was successful. I then tried loading http://localserver/gflax/Examples/ASP/example2.asp

and I get the following error message.

GflAx.GflAx.1 error '80004005'

Error to open file

/gflax/Examples/ASP/example2.asp, line 25

I tried restarting the computer, but I get the same error.

Do I need to install gflax on that computer?

I would really appreciate any help.

Code: Select all

<%
'   Load a picture, change the color depth. Horizontal flip
'   resize his canevas, and display it.

'   Use a ASP file as source of a <IMG> tag to display a picture in a HTML page

'   The following contenttype are available :
'   response.contenttype = "image/jpeg"
'   response.contenttype = "image/gif"
'   response.contenttype = "image/png"
'   response.contenttype = "image/bmp"
'   response.contenttype = "image/tiff"
'   response.contenttype = "image/xpm"

Dim Path, File

Set ctrl = server.createobject("GflAx.GflAx")
Path = Server.MapPath("/GflAx") 
File = Path & "\image.jpg"

const AX_JPEG = 3
const AX_To16Colors = 16

With ctrl
    .LoadBitmap File
    .ChangeColorDepth AX_To16Colors
    .FlipHorizontal
    .ResizeCanvas .Width +10, .Height +10, RGB(0,0,0)
    .Saveformat = AX_JPEG

    response.contenttype = "image/jpeg"
    response.binarywrite .SendBinary
end with

set ctrl=nothing
%>
thanks,
ruthless
ruthless
Posts: 11
Joined: Wed Jan 05, 2005 7:06 pm

Post by ruthless »

got it to work. It was my fault...

I want to use this to create random images for form registeration.

Many forums use random images to confirm that the form was submitted by the user and not some script.

Does any one know how I can use this lib to create an image that displays an random image.

Also does anone know any website where I can get to know how the registration form with random number works? I want to know how to implement it.

I would really appreciate any help.
User avatar
helmut
Posts: 8240
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

ruthless wrote:Also does anone know any website where I can get to know how the registration form with random number works? I want to know how to implement it.
The example1 coming with GFL AX should help you to create a dynamic picture. The example is explained a bit in post 'GflAx.GflAx.1 (0x80004005) - ASP sample does not run'

Once you have a dynamic picture, it should not be hard to make it's contents random. You could pad several images containing ciphers or letters to one larger images and display this one. Or you could use the text feature of GFLAX to create a fully dynamic image.

HTTP is stateless, so you have to store the solution of your graphical riddle in the session. Or you pass it as hidden parameters (sure enough with some encryption so that the user cannot easily find out the solution).

That's just some ideas...

Hope this helps, Helmut
ruthless
Posts: 11
Joined: Wed Jan 05, 2005 7:06 pm

Post by ruthless »

Thanks for your reply.

Where can I find all the command to alter the file.

I could not find the commands that were used in ASP under "Help.chm"

For Example...
.FontName
.FontSize
.TextOut

Also if I want to resize the canvas but center the image how do I go about it?
User avatar
helmut
Posts: 8240
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

ruthless wrote:Where can I find all the command to alter the file.

I could not find the commands that were used in ASP under "Help.chm"

For Example...
.FontName
.FontSize
.TextOut
These do not look like GFL AX commands. Where did you find them in the online help?
For adding text, you have to use gflAddText. Just search the help for "gflAddText".
ruthless wrote:Also if I want to resize the canvas but center the image how do I go about it?
Search the help for "gflResizeCanvas". For centering the image, you simply use GFL_CANVASRESIZE_CENTER for parameter "mode".
ruthless
Posts: 11
Joined: Wed Jan 05, 2005 7:06 pm

Post by ruthless »

Those command are in the ASP example files under the gfLAX folder :)
User avatar
helmut
Posts: 8240
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

ruthless wrote:Those command are in the ASP example files under the gfLAX folder :)
Right, in example3.asp these attributes are used:

Code: Select all

Set ctrl = server.createobject("GflAx.GflAx")
...
With ctrl
     ...    
    .FontName = "arial"
    .FontSize = 13
    .TextOut .About, 2, 2, RGB(255, 255, 255) 'Write library version on the picture
     ...
end with
...
Looks as if the root object has some attributes which are not documented. At least I cannot find these, but perhaps I just don't understand the code or the help right.

Someone more experienced with GFL AX has to help you here.
ruthless
Posts: 11
Joined: Wed Jan 05, 2005 7:06 pm

Post by ruthless »

Does anyone have an example of how to open a file and resize the canvas to 120x120 center aligned and save it?

Any help will be appreciated.
User avatar
rozi
Posts: 3
Joined: Sat Feb 05, 2005 1:34 pm
Location: Slovenia

Post by rozi »

ruthless wrote:Does anyone have an example of how to open a file and resize the canvas to 120x120 center aligned and save it?

Any help will be appreciated.
You can try loading the image, read it's dimensions WxH, create a new blank white image with size 120x120 and then use DrawImage(), to draw your image in center of the new blank image at offset:

Code: Select all

x = (120 - W) / 2
y = (120 - H) / 2